Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



Creating an App Engine Connected Android Project

If you are creating a new Android app, you can choose to create one that is designed for an App Engine backend using the App Engine Android Connected Project wizard. This wizard creates a sample application that consists of an Android app that has an App Engine backend. The sample Android app registers with the backend via an Endpoints API and receives messages from the backend via Google Cloud Messaging for Android. The sample app consists of required boilerplate code along with sample code that can be easily replaced by your own app code.

The App Engine backend provides an API to register Android clients and a Web UI to broadcast messages to clients.

To generate this project using the App Engine Android Connected Project wizard:

  1. Click File > New > Other > Google > App Engine Connected Android Project :

  2. This opens the wizard. Enter a project name and package name of your choice:

  3. Enter the Project number for your Google Cloud project into the wizard. The generated Android application needs this number to register for Google Cloud Messaging. The Project Number is listed in the top-left corner of your project's Overview tab in Google Developers Console .

    (You can always add the project number later by modifying the value of PROJECT_NUMBER in GCMIntentService.java)

  4. Enter the API key into the wizard. For that, you must enable Google Cloud Messaging for Android in the "APIs & auth" section of your project in Google Developers Console .

    Then, navigate to "Credentials" subsection (within "APIs & auth" section) and copy the API key for server applications back into the wizard. This enables App Engine to securely communicate with the Google Cloud Messaging server.

    (You can always add the API key later by modifying the value of API_KEY in MessageEndpoint.java)

  5. To test the app with the backend running locally, in your Android project within the CloudEndpoints class, set LOCAL_ANDROID_RUN to true. This indicates that the Android application connects to the local App Engine backend.
  6. Start the App Engine app (right click > Run as > Web Application).

    Run your Android application in your emulator running a target with Google APIs.

  7. Run your Android application in your emulator and click the Register button.

  8. Verify that the Device registration was recorded in the local App Engine backend by navigating to the Datastore Viewer from the following URL: http://localhost:8888/_ah/admin .
  9. Access the backend UI to view registered devices and send GCM messages to them:

    http://localhost:8888

  10. View GCM messages as they arrive in your Android application:

At this point, you are ready to add and annotate entities needed for your Android app.

Authentication required

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

Signing you in...

Google Developers needs your permission to do that.