MoEngage Docs

SDK Initialization

The SDK initialization required by MoEngage

SDK Configuration

Get APP ID from the Settings Page on the MoEngage dashboard and initialise the MoEngage SDK in the Application class's onCreate()

// 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);

Refer to the API reference doc for detailed list of possible configuration.

Note

All the configuration should be added to the builder before calling initialise. If you are calling initialise at multiple places please ensure that all the required flags and configuration is set each time you initialise to maintain consistency in behaviour.

Install/Update Differentiation

This is solely required for migration to MoEngage Platform. We need your help to tell the SDK whether the user is a new user for on your app or an existing user who has updated to the latest version.

If the user was already using your application and has just updated to a new version which has MoEngage SDK it is an updated call the below API

MoEHelper.getInstance(getApplicationContext()).setExistingUser(true);

In case it is a fresh install call the below API

MoEHelper.getInstance(getApplicationContext()).setExistingUser(false);

This code should be done in your Application class and should be called only once.

If this code is not added Smart Trigger InApp/Push Campaigns on INSTALL event will not work.

This should not be coupled with login logic. This is solely required for migration to MoEngage Platform.