Push Messaging

Adobe Mobile and the Adobe Mobile SDK allow you to send push messages to your users. The SDK also allows you to easily report users that have opened your app as a result of clicking through a push message.

Note: Requires SDK version 4.6 or later. Important: Do not manually set the Marketing Cloud Visitor ID inside your app. Setting the Visitor ID inside your app causes the creation of a new unique user that will not receive push messages because of its opt-in status. For example, suppose a user that has opt-ed in to receive push messages logs in to your app. After logging in, if you manually set the ID inside your app, a new unique user is created that has not opted to receive push messages. This new user will not receive your push messages.

This section contains the following information:


Enable Push Messaging

Note: If your app is already set up to use messaging via GCM, some of the following steps may already be completed.

  1. Verify that ADBMobileConfig.json contains the required settings for push messaging. The "marketingCloud" object must have its "org" property configured for push messaging.

    "marketingCloud": {
    		"org": <;org-id-string>

    A guide for setting up GCM can be found on the Google Developers website.

    Implementation of a sample app can be found at https://github.com/googlesamples/google-services/tree/master/android/gcm.

  2. The registration ID/token must be passed to the SDK using the method Config.setPushIdentifier(final String registrationId).

    For example, in the RegistrationIntentService.java file in the sample app above (https://github.com/googlesamples/google-services/blob/master/android/gcm/app/src/main/java/gcm/play/android/samples/com/gcmquickstart/RegistrationIntentService.java), the SDK call should be made after the token is received.

    InstanceID instanceID = InstanceID.getInstance(this);
    String token=instanceID.getToken(getString(R.string.gcm_defaultSenderId),GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
  3. Enable reporting by passing your activity in the collectLifecycleData method.

    There are two requirements for enabling push clickthrough reporting:

    • In your implementation of GCMListenerService, the Bundle object containing the message data (passed into the onMessageReceived method) must be added to the Intent used to open the target activity on a clickthrough.

      This can be done using the method putExtras (http://developer.android.com/reference/android/content/Intent.html#putExtras(android.os.Bundle)).

    • In the target activity of the clickthrough, the activity must be passed into the SDK with the collectLifecycleData call.

      Use either Config.collectLifecycleData(this) or Config.collectLifecycleData(this, contextData).

      Do not use Config.collectLifecycleData().

Parent topic: Messaging