While multiple push SDKs can be integrated into a single app, this may cause issues, and we cannot guarantee results. This section provides some considerations you should keep in mind as you develop your app. Areas of concern can include registration, geolocation and more. Note that this is not an exhaustive list.

Any other push provider you choose must also allow a multiple GCM implementation.

For example, registration requires a resilient token. To produce a resilient token, register with every known GCM Sender ID (Project ID) in a comma-delimited string. This example code works for both single and multiple SDKs:

Implement one of two options for your push token:

  1. Let the SDK handle the push token.
  2. Handle the push token yourself.

Option 1 - SDK Push Token Handling

  1. Set the GCM Sender ID during initialization.
  2. Get the push token from the SDK:
  3. Listen for changes to the push token:

Option 2 - Manual Push Token Handling

  1. Do not set the GMC Sender ID during initialization.
  2. Notify the SDK of the push token during first retrieval and any subsequent changes. The SDK does not make a call for Registration until this value is set.

Push Data Handling

Use this method to identify push message sent from Marketing Cloud:

PushMessageManager.isMarketingCloudPush(Bundle)

Use this method to make Marketing Cloud handle a push message:

PushMessageManager#handlePushMessage(Bundle)

Use this method to retrieve debugging information about services and receivers registered to your application that use GCM:

PushMessageManager#getPushDebugInfo()

Follow these steps to register a GCM service to intercept push messages:

  1. Create a service that extends GcmListenerService.
  2. In onMessageReceived, check to see if the message came from Marketing Cloud.
  3. If so, call the PushMessageManager’s handlePushMessage method.
  4. If not, handle the push message yourself:
  5. Register your new service in your application’s manifest:

Other methods for handling push messages depending on the specifics of your application’s implementation.