Android Migration Steps
To migrate from manual code-based initialization to the XML file-based approach, follow the below steps:- Add configuration file :Add your generated
moengage.xml(or any .xml under res/values/ with the correct com_moengage_ resource entries) to the app module, in theandroid/app/src/main/res/values/moengage.xmlpath. - Update the Application class : In
android/app/src/main/java/<your/_package>/MainApplication.java (or .kt), remove theMoEngage.Buildersetup and call file-based initialization instead.
iOS Migration Steps
To migrate from code-based initialization to theInfo.plist based approach, follow these steps:
- Update Info.plist: Add the required MoEngage configuration keys (e.g., WorkspaceId, DataCenter) inside the MoEngage key in your
Info.plistfile. - Update AppDelegate: Remove the existing initialization code (the manual MoEngageSDKConfig logic) from your
AppDelegateclass and replace it with the default instance initialization to enable reading from theInfo.plistfile.
Precedence Rules
The source of configuration is determined by the initialization function called in your native code:- Android:
- File-Based Init: Calling
MoEInitializer.initializeDefaultInstance(context)instructs the SDK to look for and read themoengage.xmlfile. - Code-Based Init: Calling
MoEInitializer.initialize(context, moEngage.Builder)will initialize the SDK using the configuration object passed in the parameters, ignoring the XML file even if it exists.
- File-Based Init: Calling
- iOS: Auto-initialization (via
Info.plist) occurs first. However, if you subsequently call the manualinitializemethod with a configuration object in your code, it will update the current instance configuration.