Troubleshooting Multiple Push SDKs
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:
- Let the SDK handle the push token.
- Handle the push token yourself.
Option 1 - SDK Push Token Handling
- Set the GCM Sender ID during initialization.
- Get the push token from the SDK:
- Listen for changes to the push token:
Option 2 - Manual Push Token Handling
- Do not set the GMC Sender ID during initialization.
- 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:
Use this method to make Marketing Cloud handle a push message:
Use this method to retrieve debugging information about services and receivers registered to your application that use GCM:
Follow these steps to register a GCM service to intercept push messages:
- Create a service that extends GcmListenerService.
- In onMessageReceived, check to see if the message came from Marketing Cloud.
- If so, call the PushMessageManager’s handlePushMessage method.
- If not, handle the push message yourself:
- Register your new service in your application’s manifest:
Other methods for handling push messages depending on the specifics of your application’s implementation.