SDK Integration

Capacitor is a cross-platform native runtime that makes it easy to build modern web apps that run natively on iOS and Android.

Adding MoEngage Plugin

Add capacitor-moengage-core plugin to capacitor project as shown below :

Shell
$npm install capacitor-moengage-core

Once the plugin is installed run ionic capacitor sync to update capacitor native platform(s) and dependencies.

 

NOTE

A working Sample App can be found here.

Integrate Native platforms

To install and integrate the respective platforms, follow the docs given below:

Initialize Plugin

Initialize the MoEngage Plugin by calling the MoECapacitorCore.initialize(). In case of Ionic-React initialize the plugin in useIonViewWillEnter() callback, for Ionic-Angular initialize the plugin in ngOnInit().

Typescript

import { MoECapacitorCore} from 'capacitor-moengage-core'
        
MoECapacitorCore.initialize();
 

NOTE

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

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