Android Push Configuration

Basic Configuration

To use Push Notification in your Flutter application, you need to configure Firebase into your application; refer to the following 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 handle the token registration and handle incoming messages by yourself, pass the push token and payload to the SDK by using the below APIs

Passing Push Token

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

Passing Push Payload

import { MoECapacitorCore } from 'capacitor-moengage-core'
// pass the push payload object
passFcmPushPayload(payload: object, appId: "YOUR_APP_ID" });


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 initialised if the application is killed or if the notification is not sent at a high priority.

Notification Runtime Permission

Android 13 (API level 33) and higher supports runtime permission for sending non-exempt(including Foreground Services (FGS)) notifications from an app POST_NOTIFICATIONS. This change helps users focus on the notifications that are most important to them.

Refer to the official documentation for more details.

The below-mentioned APIs are supported from Plugin version 2.0.0

When the application is running on Android 13 to show notifications to the user, applications would need to request the user for notification permission.

For applications integrating the MoEngage SDK, would need to 

  • Notify the SDK of the permission request's response from the user.
  • If the application has already requested push permission(before MoEngage integration) help MoEngage set up notification channels for notification display.

Notify SDK of permission result

Once the application requests the user for notification permission notify the SDK of the user response using the below API.

import { MoECapacitorCore} from 'capacitor-moengage-core'
MoECapacitorCore.pushPermissionResponseAndroid({ isGranted: true/false });

Setup Notification Channels

If the application has already taken notification permission from the user call the below API to set up Notification Channels for showing push notifications.

import { MoECapacitorCore} from 'capacitor-moengage-core'

MoEngage SDK provides helper APIs to show the permission request to the end-user or navigate the user to the settings screen for enabling notifications.

Use the below API to show the permission request dialog to the user.

When using the below API SDK automatically tracks the response, sets up the required notification channel, etc, mentioned above.

import { MoECapacitorCore} from 'capacitor-moengage-core'

Use the below API to show navigate the user to the Notification Settings for the application on the device.

Note: Below Android 8(API level 26) the user is directed to the Application Info screen of your application.

import { MoECapacitorCore} from 'capacitor-moengage-core'

Customizing Push notification

If required the application can customize the behavior of notifications by using Native Android code (Java/Kotlin). To learn more about the customization refer to the 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, and Geofence.

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

How can we improve this article?