Overview

Skill Level: Intermediate

Due to changes in the way that Android handles GCM, if you are migrating the Android SDK from an earlier release to 3.7.1.0.2 (or later), you must make a few changes to the AndroidManifest.xml.

Prerequisites

To get started, make sure you have a release of the Android SDK before 3.7.1.0.2 installed on your app.

Add Job Service

Release 3.7.1.0.1 included an additional service to support jobs on Android O and later. You will need to integrate that if you’re not already on 3.7.1.0.1. Add the following new service to AndroidManifest.xml:

<service android:name=”com.ibm.mce.sdk.job.MceJobService” android:permission=”android.permission.BIND_JOB_SERVICE”/>

FCM Users

If you are using FCM and are migrating the Android SDK from an earlier release to 3.7.1.0.2 (or later), you do not need to make any further changes. The MceJobService service is sufficient.

Cordova Users

If you are migrating the Cordova build from an earlier release to one later than 3.5.0, you must make the changes described in this tutorial when setting up the Android project. For more information, see the Getting started with apps developed with Cordova.

Step-by-step

  1. Update the AndroidManifest.xml file.

    Update the AndroidManifest.xml by performing these steps:

    1. Replace
      <receiver android:name="com.ibm.mce.sdk.gcm.GcmBroadcastReceiver"

      with

      <receiver android:name="com.google.android.gms.gcm.GcmReceiver"

      This step adds the new GCM receiver to your code. To build with this class, you must include Google Play Services v7.5 (or later).

    2. Replace
      <service android:name="com.ibm.mce.sdk.gcm.GcmIntentService"/>

      with

      <service android:name="com.ibm.mce.sdk.gcm.MceGcmListenerService" android:exported="false" >
        <intent-filter>
          <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        </intent-filter>
      </service>
      

      This step adds the customer listener service that is defined in SDK 3.7.1.0.2 (and later). The service implements GCM behavior according to the new specification.

    For information about integrating the Mobile App Messaging SDK with your Android app, see Getting started with Mobile App Messaging in Android apps (GCM) .

Join The Discussion

Your email address will not be published. Required fields are marked *