Android Migration Steps
To migrate from manual code-based initialization to the XML file-based approach, follow the below steps:- Add Configuration File: Place the
moengage_configfile in the (src/main/assets/moengage.xml) path. - Update Application Class: Remove the existing initialization code (the manual
MoEngage.Builderlogic) from your Application class and replace it with the default instance initialization to enable reading from the XML file.
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.