Android Push Configuration

To use Push Notification in your Capacitor application you need to configure Firebase into your application, refer to the Push Notification documentation to configure Push Notification in your application.

In case, your application is handling the push token registration and push payload we highly recommend you use the native Android methods(mentioned in the documentation above) for passing the token and the payload to the SDK.
If for whatever reason you wish to pass the push token and payload to the SDK via the Capacitor code uses the below APIs

Passing Push Token

TypeScript
import { MoECapacitorCore } from 'capacitor-moengage-core'
// pass the push token as a string
MoECapacitorCore.passFcmPushToken({ token: "TOKEN" });

Passing Push Payload

TypeScript
import { MoECapacitorCore } from 'capacitor-moengage-core'
// pass the push token as a string
MoECapacitorCore.passFcmPushPayload({ payload: json });
warning

Warning

We highly recommend you to use the Android native APIs for passing the push payload to the MoEngage SDK instead of the Capacitor APIs. Capacitor Engine might not get initialized if the application is killed or if the notification is not sent at a high priority. 

Customizing Push notification

If required the application can customize the behavior of notification by using Native Android code (Java/Kotlin). To learn more about the customization refer to Advanced Push Configuration documentation.
Instead of extending PushMessageListener as mentioned in the above document extend PluginPushCallback

Refer to the below documentation for Push Amp+, Push Templates, Geofence.

Previous

Next

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

How can we improve this article?