page.title=Getting Started page.tags="cloud","push","messaging" @jd:body

In this document

  1. Creating a Google API Project
  2. Enabling the GCM Service
  3. Obtaining an API Key
  4. Next Steps

See Also

  1. Google Cloud Console
  2. Google Cloud Console Help
  3. CCS and User Notifications Signup Form

This document tells you how to get started setting up a GCM implementation. Before you begin, make sure to set up the Google Play Services SDK. You need this SDK to use the {@code GoogleCloudMessaging} methods.

Creating a Google API project

To create a Google API project:

  1. Open the Google Cloud Console.
  2. If you haven't created an API project yet, click Create Project.
  3. Supply a project name and click Create.

    Once the project has been created, a page appears that displays your project ID and project number. For example, Project Number: 670330094152.

  4. Copy down your project number. You will use it later on as the GCM sender ID.

Enabling the GCM Service

To enable the GCM service:

  1. In the sidebar on the left, select APIs & auth.
  2. In the displayed list of APIs, turn the Google Cloud Messaging for Android toggle to ON.

Obtaining an API Key

To obtain an API key:

  1. In the sidebar on the left, select APIs & auth > Registered apps.
  2. Click Register app.
  3. In the Name field, type your app's name.
  4. Click Android > Accessing APIs directly from Android.
  5. Under Android identification, type the package name for your app.
  6. Enter an SHA1 fingerprint. To get this value, follow the instructions in the console help.
  7. Click Register.
  8. In the new page, open the Android Key section and copy the API key. You will need the API key later on to perform authentication in your application server.
  9. Note: If you need to rotate the key, click the "recycle key" icon. A new key will be created. If you think the key has been compromised and you want to delete it immediately, you can accomplish this by deleting the app from the console. Then create a new entry for the app with the same SHA1 and package name.

Next Steps

Once you've finished the tasks listed above, you're ready to start implementing GCM. Here is an overview of the basic steps:

  1. Decide which Google-provided GCM connection server you want to use— HTTP or XMPP (CCS). GCM connection servers take messages from a 3rd-party application server (written by you) and send them to a GCM-enabled Android application (the "client app," also written by you) running on a device.
  2. Implement an application server (the "3rd-party application server") to interact with your chosen GCM connection server. The app server sends data to a GCM-enabled Android client application via the GCM connection server. For more information about implementing the server side, see Implementing GCM Server.
  3. Write your client app. This is the GCM-enabled Android application that runs on a device. See Implementing GCM Client for more information.