This migration is required only for people who have integrated plugin version 3.2.0 or below. If your plugin version is greater than 3.2.0 you can ignore this step.
Removing existing plugin
Remove MoEngage SDK Plugin
cordova plugin remove moengagesdk
Remove MoEngage Push Extension, if added. Use the command
cordova plugin list to check whether the plugin is installed or not.
cordova plugin remove moengagepushextension
Install the new plugin
Install the new MoEngage SDK plugin.
cordova plugin add moengagesdk --variable APP_ID="[your_app_id]"
- APP_ID = App id found under the settings page on the MoEngage dashboard.
Initialize SDK(only for Android)
To initialize SDK create a class extending
Application the class of Android and override
onCreate() initialize the SDK as shown below.
// this is the instance of the application class and "XXXXXXXXXXX" is the APP ID from the dashboard. MoEngage moEngage = new MoEngage.Builder(this, "XXXXXXXXXXX") .build(); MoEngage.initialise(moEngage);
Make sure your application class is defined in the
AndroidManifest.xml file as well.
Setting up Push Notification(only Android)
MoEngage SDK supports both FCM and GCM, based on what you are using in your application install the appropriate plugin.
The SDK no longer ships with Google's GCM or FCM library please ensure you have added the appropriate dependency in your app.
cordova plugin add cordova-moengage-fcm-dependency
cordova plugin add cordova-moengage-gcm-dependency
If MoEngage SDK is registering for push notification add the appropriate FCM/GCM listeners.
cordova plugin add cordova-moengage-fcm-listeners
cordova plugin add cordova-moengage-gcm-listeners
Adding Push Related Meta Data
Refer to Push Notification documentation and add all the required meta-data for push notifications to work.