Basic setup
Follow the basic setup outlined in this section to enable push notifications on an Android device using MoEngage.- FCM Setup on MoEngage Dashboard - FCM Authentication is the method to enable sending push notifications to your app installed on Android devices. Use the methods mentioned in this article to authenticate MoEngage to access Firebase services.
- Adding metadata for push notification - Set the small icon and large icon drawable and other options to handle push notifications using the methods available in this article.
- Android Notification Runtime Permissions - When the application is running on Android 13 to show notifications to the user, applications would need to request the user for notification permission. Refer to the methods available in this article to handle permission requests.
- Push Registration and Receiving - To use Push Notification in your Flutter application, you need to configure Firebase. Depending on your requirements, refer to one of the below methods to enable Push Registration and Receiving.
- Let MoEngage handle Push(Recommended)
- You handle Push via Android Native
- You handle Push via Flutter (Not Recommended)
Add messaging serviceStarting from version 10.4.0, the SDK automatically adds the Firebase service declaration to
Callback on token registration(optional)
To get an optional callback whenever a new token is registered or the token is refreshed, refer to the method here.Notification Clicked Callback
To receive a callback whenever a push is clicked and for custom handling redirection, use the method in this article.
AndroidManifest.xml. The file MoEFireBaseMessagingService is declared with low priority (android:priority=“-1”) in AndroidManifest.xml. file to prevent conflicts.| Integration Scenario | System Behavior | Action Required |
|---|---|---|
| MoEngage Only | The SDK automatically handles push payloads and token updates using the built-in service. | Update & Build: Ensure you are on the latest SDK version and run flutter clean before building. No manifest changes are needed. |
| Multiple Push Providers | The Android system prioritizes your messaging service over the MoEFireBaseMessagingService. | Pass Data Manually: In your custom FirebaseMessagingService, intercept the payload and token. Pass them to the MoEngage SDK APIs if the data originates from the MoEngage platform. |
For versions below 10.4.0, You must add the
MoEFireBaseMessagingService to the AndroidManifest.xml file for MoEngage SDK to show the notifications. Refer here.To get an optional callback whenever a new token is registered or the token is refreshed, refer to the method here.Notification Clicked Callback
To receive a callback whenever a push is clicked and for custom handling redirection, use the method in this article.