Framework Initialization 9.x.x

Initialize React-Native Component

Initialize the MoEngage Plugin in the App.js or App.ts of your application once the component is mounted.

TypeScript
import ReactMoE from 'react-native-moengage';
ReactMoE.initialize("YOUR_Workspace_ID");

Example

TypeScript
import ReactMoE from 'react-native-moengage';

useEffect(() => { ReactMoE.initialize("YOUR_Workspace_ID"); }, []);
info

Note

If you have a class-based component then you can initialize in the render() or componentDidMount()

Initialize with Configuration (optional)

TypeScript
import ReactMoE from 'react-native-moengage';
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);
warning

Warning

Make sure you are setting the Push/InApp callback listeners before calling the initialize().

Refer to the following for platform-specific initialization:

For more information about samples, refer to React-Native Sample App.

Previous

Next

Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?