Overview
This is the final step to activate the MoEngage SDK. Calling the initialize method activates your configurations and lets the SDK start tracking data and handling messages.
| library_add_check |
Prerequisites You must complete the installation and configuration guides before you initialize the SDK. |
Initialize the SDK
We recommend you initialize the SDK in your app's root component, which is usually App.js or App.tsx. To initialize the SDK, write the following code:
import ReactMoE from 'react-native-moengage';
useEffect(() = {
ReactMoE.initialize("YOUR_Workspace_ID");
},[]);
The MoEngage SDK is now fully operational in your app.
To see detailed SDK logs in your console for development, initialize with a log configuration. This step is optional.
import { MoEInitConfig, MoEPushConfig, MoEngageLogConfig, MoEngageLogLevel } from "react-native-moengage";
const moEInitConfig = new MoEInitConfig(
MoEPushConfig.defaultConfig(),
new MoEngageLogConfig(MoEngageLogLevel.DEBUG, isEnabledForReleaseBuild)
);
ReactMoE.initialize(YOUR Workspace ID, moEInitConfig);
| info |
Note The minimum supported version for |
Next steps
With the SDK initialized, you can start using other MoEngage features: