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.
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);
The minimum supported version for expo-notification is 0.31.0.
Next steps
With the SDK initialized, you can start using other MoEngage features: