The Android SDK requires use of the MceApplication class or a class that extend it as the application class of the application. This causes the SDK to start when the application starts, and there is a way to avoid it. A different application class can be used, and it can call the SDK init method to start the SDK. If this is done, no SDK call can be made before the SDK init method is called. The SDK init method also allows a callback object that can be called in the following SDK initialization stages:

  • When the manifest metadata is loaded, the object receives the metadata object.
  • When a notification action is loaded, the object receives the action JSON object.
  • Right after the SDK start is called, the object receives the appkey, senderId, sessionEnabled, sessionDuration, loglevel, and log to
    file parameters.
  • Here is how you do it with MceSdkConfiguration class:

    MceSdkConfiguration mceSdkConfiguration = new MceSdkConfiguration(“appKey”, “senderId”);
    //setting invalidate existing user to true
    mceSdkConfiguration.setInvalidateExistingUser(true);
    MceApplication.init(this, mceSdkConfiguration, new SdkInitLifecycleCallbacks() {
    @Override
    public void handleMetadata(Bundle bundle) {

    }

    @Override
    public void onPluginActionLoad(JSONObject jsonObject) {

    }

    @Override
    public void onPluginNotificationTypeLoad(JSONObject jsonObject) {

    }

    @Override
    public void onStart(MceSdkConfiguration mceSdkConfiguration) {

    }

    @Override
    public void onSdkReinitializeNeeded(Context context) {

    }
    });

    Go Back to the Mobile App Messaging home page.

    Join The Discussion

    Your email address will not be published. Required fields are marked *