Migrating to 7.x.xx

Removing components

Remove the below components from your manifest file

XML
<receiver android:name="com.moe.pushlibrary.AppUpdateReceiver" >
    <intent-filter>
        <action android:name="android.intent.action.PACKAGE_REPLACED" />
        <data
          android:path="[YOUR_PACKAGE_NAME/applicationId]"
          android:scheme="package" />
    </intent-filter>
</receiver>

<provider android:name="com.moe.pushlibrary.providers.MoEProvider"
    android:authorities="[YOUR_PACKAGE_NAME/applicationId].moengage.provider"
    android:exported="false" />

Change GcmBroadcast Receiver name

If your app uses play services version less than 7.5 and have GCMBroadcastReceiver from Moengage SDK rename it from "com.moe.pushlibrary.PushGcmBroadcastReceiver" to "com.moengage.receiver.MoEngagePushReceiver". Final component in manifest should be below

Text
<!-- If you have specified applicationId in build.gradle file then replace [YOUR_PACKAGE_NAME] with applicationId-->
<!-- MOENGAGE RECEIVER FOR RECEIVING GCM BROADCAST MESSAGES -->
<receiver android:name="com.moengage.receiver.MoEngagePushReceiver"
  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/applicationId]" />
    </intent-filter>
</receiver>

Removing Lifecycle callbacks for MoEngage SDK(optional)

Note: Minimum API level >= 14
This step is not necessary.Implement only if you want to remove SDK lifecycle callbacks
You can remove lifecycle callbacks for MoEngage SDK and below line of code enable Activity tracking.

To opt-out from activity tracking Opt-outs.

Java
public class MyApplcation extends Application
{
    public void onCreate() {
        super.onCreate();
        MoEHelper.getInstance(getApplicationContext()).autoIntegrate(this);
    }
}

Custom Action Class for Push Notification

If you have implemented custom action for push notification then you have to make below changes

  1. Method signature of IActionHandler.onActionPerformed has changed to:
    Java
    public interface IActionHandler {
    	boolean onActionPerformed(Context context, String tag, JSONObject actionObject);
    }
  2. Additionally the developer needs to register to receive a callback for custom actions. This could be done as follows :
    Java
    PushActionManager.getInstance().registerActionHandler(new IActionHandlerImpl);
  3. Getting payload :
    Java
    @Override
      public boolean onActionPerformed(Context context, String s, JSONObject jsonObject) {
        try {
          if (jsonObject != null) {
            String customPayload = jsonObject.getString("custom_payload");
            if (!TextUtils.isEmpty(customPayload)){
              //your action on the payload
            }
          }
        }catch (JSONException e) {
            e.printStackTrace();
        }
        return false;
      }

APIs removed

  1. MoEHelper

    • Register(int drawableId)
    • Register(int drawableId, String gcmToken)
    • enableGCMRegistration(Context context, boolean enable)
    • ByPassPushesTo(String serviceClassName)
    • suppressInAppMessageHere(true)
    • onPause(context)
    • setGeoFencesAroundLatLng(final double lat, final double lng, Context con)
  2. PushGCMReceiverHook

Re-import class reference in Java file

  1. MoEngageNotificationUtils

Method Signature Change

  1. PushManager.getInstance()

Older

Java
PushManager.getInstance(context)

Current

Java
PushManager.getInstance()
Was this article helpful?
0 out of 0 found this helpful