MoEngage Docs

Migrating to 7.x.xx

Changes to be made when migrating from older Moengage Android SDKs to v7.x.xx

Removing components

Remove below components from your manifest file

<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

<!-- 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.

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

To opt-out from activity tracking Optouts

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:
public interface IActionHandler {
	boolean onActionPerformed(Context context, String tag, JSONObject actionObject);
}
  1. Additionally the developer needs to register to receive a callback for custom actions. This could be done as follows :
PushActionManager.getInstance().registerActionHandler(new IActionHandlerImpl);
  1. Getting payload :
@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

PushManager.getInstance(context)

Current

PushManager.getInstance()

Migrating to 7.x.xx


Changes to be made when migrating from older Moengage Android SDKs to v7.x.xx

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.