Google Cloud Platform

Extending the Mobile Backend

The Mobile Backend provides a wrapper around some of Google Cloud's core features - Google Cloud Datastore, Google Cloud Endpoints, Google Cloud Messaging and Prospective Search API. The server component is an open source Google App Engine app, written in Java.

As your application grows, you may find the features of the Mobile Backend limiting, so we encourage you to extend the source code to include customizations specific to your app's needs. The source code also provides an excellent resource to start learning about Google's cloud.

Setup Instructions

These instructions assume you have the the Google Plugin for Eclipse (GPE) and Android SDK installed. If you have already run the Android sample, you will already have GPE and Android SDK.

  1. Create a Web Application Project in Eclipse, click on the Google menu (blue circle with a "g") > New > Web Application Project to show the New Web Application Project dialog:
    • Enter MobileBackend for Project Name
    • Enter com.google.cloud.backend for Package Name
    • Deselect Use Google Web Toolkit
    • Deselect Generate project sample code
    • Click Finish
  2. Download the Mobile Backend source code zip file (or clone from GitHub repository)
  3. Copy the src and war directories from inside the zip file to the root directory of the Eclipse project
  4. The Mobile Backend Starter requires the following jar files not included in the source code above to ensure you get the latest versions, or for licensing constraints. Add the following jar files to war/WEB-INF/lib directory of the Eclipse project:

    • Open Android SDK Manager and choose Extras > Google Cloud Messaging for Android Library. This creates a gcm directory under YOUR_ANDROID_SDK_ROOT/extras/google/gcm-server/dist subdirectory which has the gcm-server.jar file.
    • Download google-gson-2.1-release.zip and extract the zip file, and you'll have the "google-gson-2.1" directory which has the gson-2.1.jar file.
    • Download the json-simple.1.1.1.jar file.
    • Download the JavaPNS-2.2.jar file.
    • Download the commons-codec-1.8.jar file.
    • Download the bcprov-jdk15on-146.jar file. By default, the downloaded jar file is signed. Execute the following command to unsign this jar file zip -d bcprov-jdk15on-146.jar META-INF/MANIFEST.MF.
    • Download the log4j-1.2.17.jar file.
  5. Select the 7 files in Eclipse (you may need to select the lib folder and hit F5 to refresh the Package Explorer), and select Build Path > Add to Build Path on right-click menu. This will remove all the errors you have on the Problems tab.

  6. Edit war/WEB-INF/appengine-web.xml and insert your app ID in the "application" element:

    <application>!!! ENTER YOUR APP ID HERE !!!</application>
    
  7. Build the project, then right-click MobileBackend project and select Google > Deploy to App Engine. This will deploy the backend to your app ID

  8. Verify your backend is working by using your browser to visit https://your-project-id.appspot.com/_ah/api/explorer, replacing your_appid with the Project ID you chose for your project earlier. If the backend is running correctly, you will see the Mobilebackend Api listed on the page. If the backend is not working, you can debug the problem via the App Engine logs:
    • Visit the Cloud Console
    • Open your project
    • Click the App Engine icon
    • In the left navigation panel, locate and click Admin Logs, under Administration
    • Examine the logs to determine the issue

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.