Skill Level: Intermediate
The 18.104.22.168.14 SDK includes a new config file option, "autoInitialize". This option is intended to assist customers who want to start the SDK at some point later than at application startup.
By default, if the “autoInitialize” option is true, the SDK starts when the app starts.
If you want to start the SDK some time after the application starts (for instance, when a user presses a “Login” button), set “autoInitialize”: false.
1. If the new SDK file option¬†“autoInitialize” does not already exist in your MceConfig.json file, add the JSON key/value pair “autoInitialize”: false, under the JSON root object. If it does exist in MceConfig.json, make sure “autoInitialize” has the value “false”.
2. In the code where the SDK is started, add the following immediately before calling MceApplication.init(your init args):
so you will end up with code that looks like below:
The “init args” may vary depending on how the MceApplication.init is called, but it must be the same for both firstInit and init.
Note: If an MceSdkConfiguration in MceApplication.init is not specified, use null for its value in firstInit.
3. If the application subclass inherits from MceApplication, no additional changes are required. If the Application subclass does *not* inherit from MceApplication, add a call to MceApplication.init in the Application class’s onCreate method:
Note that “your init args” in this call must also match those in firstInit().
When setting “autoInitialize”: false, the SDK will not actively initialize when you call MceApplication.init() – unless you have previously called MceApplication.firstInit().
This tutorial takes you through the basic steps in configuring the SDK’s new config file option, “autoInitialize”.
Go Back to Mobile Application Messaging home page.