For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.


Set up push notifications for Android

To set up push notifications for Android devices and to enable push for Cordova applications for Android, we must use the Google Cloud Messaging (GCM) service. In order to use GCM, you need a valid Google account.


Before you begin

Before you set up push notifications for Android in IBM MobileFirstâ„¢ Platform Foundation, you must have an existing Google API project in the Google Developers Console (http://code.google.com/apis/console). This project must have a server key credential defined.

To configure a new API project in the Google Developers Console, go to https://developers.google.com/mobile/add

For more information about the credentials required for GCM, review the GCM components and credentials table descriptions on the Google Cloud Messaging: Oveview page at Google Developers.


Procedure

  1. Gather the following information about your Google API project from Google Developers Console (http://code.google.com/apis/console):
    Project number
    The project number is a globally unique numerical value created when you create your Google API project. Be careful not to use either the project name or project ID as the senderID value.

    We can find the project number in the Google Developers Console dashboard by expanding your project and recording the value under Project number.

    Server key
    Make sure that the server key is not restricted to any specific URL. For more information about how to create the key, see API keys.

    We can get your server API from Credentials page in Google Developers Console by selecting API Manager > Credentials.

  2. If your organization has a firewall that restricts the traffic to or from the Internet, you must do the following steps:
    1. Configure the firewall to allow connectivity with GCM in order for our GCM client apps to receive messages. The ports to open are 5228, 5229, and 5230. GCM typically uses only 5228, but it sometimes uses 5229 and 5230. GCM does not provide specific IP, so we must allow your firewall to accept outgoing connections to all IP addresses contained in the IP blocks listed in Google's ASN of 15169. For more information, see Implementing an HTTP Connection Server.
    2. Ensure that your firewall accepts outgoing connections from IBM MobileFirst Platform Foundation push notification service to android.googleapis.com on port 443.
  3. We can set the certificates using any of the following methods:
  4. To set up Google Play Services in your Android project, see https://developers.google.com/android/guides/setup.

Parent topic: Setting up push notifications