Follow the installation steps mentioned here.
Changes required to migrate to 5.x are minimum but some structural changes require you to remove some lines of code. This had to be done to make it loosely coupled and easy to integrate
- No change in Manifest permissions
- Basic integration points remain same
- Changes in receivers & services
- Deprecated few APIs and provided alternatives
- Inbox moved out of Main SDK and added to add-on lib
If using Play Services 7.3 No Changes in the following receivers.
<!-- MOENGAGE RECEIVER FOR RECEIVING GCM BROADCAST MESSAGES -->
<receiver
android:name="com.moe.pushlibrary.PushGcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="{YOUR_PACKAGE_NAME}" />
</intent-filter>
</receiver>
<!-- MOENGAGE RECEIVER FOR RECEIVING INSTALLATION INTENT -->
<receiver android:name="com.moe.pushlibrary.InstallReceiver" >
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
If using Google Play Services 7.5
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="{YOUR_PACKAGE_NAME}" />
</intent-filter>
</receiver>
<service
android:name="com.moengage.worker.MoEGCMListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
</intent-filter>
</service>
<service
android:name="com.moengage.receiver.MoEInstanceIDListener"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
Remove the following receivers
<!-- MOENGAGE RECEIVER FOR RECEIVING PACKAGE UPDATED INTENT -->
<receiver android:name="com.moe.pushlibrary.PushUpdateReceiver" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data
android:path="{YOUR_PACKAGE_NAME}"
android:scheme="package" />
</intent-filter>
</receiver>
<!-- MOENGAGE SERVICE PROCESSING GCM MESSAGES -->
<service android:name="com.moe.pushlibrary.PushGCMIntentService" />
<!-- MOENGAGE RECEIVER FOR INTERNAL PURPOSE -->
<receiver android:name="com.moe.pushlibrary.PushGcmRegister" />
<!-- MOENGAGE RECEIVER FOR TRIGGERING INTERACTION DATA SYNC -->
<receiver android:name="com.moe.pushlibrary.SendReport" />
Add the following Receivers
<receiver android:name="com.moe.pushlibrary.AppUpdateReceiver" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data
android:path="{YOUR_PACKAGE_NAME}"
android:scheme="package" />
</intent-filter>
</receiver>
Add the following Provider
<provider
android:name="com.moe.pushlibrary.providers.MoEProvider"
android:authorities="{YOUR_PACKAGE_NAME}.moengage.provider"
android:exported="false" />
Add the following <meta> tags
<!-- MANDATORY FIELD: APP ID AS SEEN ON MOENGAGE DASHBOARD APP SETTINGS PAGE -->
<meta-data
android:name="APP_ID"
android:value="DAO6UGZ73DXXTK7BXX96TPXX" />
<!-- MANDATORY FIELD: SENDER ID , i.e. THE PROJECT NUMBER AS MENTIONED ON GOOGLE CLOUD CONSOLE PROJECTS PAGE -->
<meta-data
android:name="SENDER_ID"
android:value="id:687214452899" />
<!-- MANDATORY FIELD: THE NOTIFICATION SMALL ICON WHICH WILL BE USED TO SET TO NOTIFICATIONS POSTED -->
<meta-data
android:name="NOTIFICATION_ICON"
android:value="@drawable/ic_launcher" />
<!-- MANDATORY FIELD: THE NOTIFICATION LARGE ICON WHICH WILL BE USED TO SET TO NOTIFICATIONS POSTED -->
<meta-data
android:name="NOTIFICATION_LARGE_ICON"
android:value="@drawable/large_icon" />
<!-- OPTIONAL FIELD: THE NOTIFICATION TYPE WHICH WILL BE USED, SINGLE OR MULTIPLE. DEFAULT BEHAVIOR IS SINGLE -->
<meta-data
android:name="NOTIFICATION_TYPE"
android:value="@integer/notification_type_multiple" />
<!-- OPTIONAL FIELD: THE NOTIFICATION TONE THAT WILL BE USED. IF NOT SET WILL PLAY THE DEFAULT SOUND -->
<meta-data
android:name="NOTIFICATION_TONE"
android:value="@raw/tring" />
Delete the following code
//Delete the INITIALISATION METHOD CALL. THIS IS DEPRECATED AND NOT REQUIRED ANY LONGER
helper.initialize( GCM_SENDER_ID, MOE_APP_ID);
//Delete the REGISTER METHOD CALL. THIS IS DEPRECATED AND NOT REQUIRED ANY LONGER
helper.Register(R.drawable.ic_launcher);
Add the following code (optional)
Add this only if you support the change in orientation.
/*
* (non-Javadoc)
*
* @see android.app.Activity#onSaveInstanceState(android.os.Bundle)
*/
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mHelper.onSaveInstanceState(outState);
}
/*
* (non-Javadoc)
*
* @see android.app.Activity#onRestoreInstanceState(android.os.Bundle)
*/
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
mHelper.onRestoreInstanceState(savedInstanceState);
}
Inbox Users
Change the following:
Old declaration
<!-- MOENGAGE INBOX ACTIVITY DECLARATION -->
<activity
android:name="com.moe.pushlibrary.activities.MoEInboxActivity"
android:label="@string/app_name" >
</activity>
Change to
<activity
android:name="com.moengage.addon.inbox.MoEInboxActivity"
android:label="@string/label_act_sec" >
</activity>
Add the Install/Update Differentiator
Add the install update differentiator as mentioned here.
In case you have any issues, please do contact the Custom Success Managers who will help you out