Configuring your MoEngage Account
- Ensure you have configured the Firebase application.
- Configure FCM Authorization on the MoEngage Dashboard. For more information, refer to FCM Authentication.
- Ensure you add the keys in both the Test and Live environments.
Adding metadata for push notification
Metadata regarding the notification is required to show push notifications where the small icon and large icon drawable are mandatory.
For more information about API reference for all the possible options, refer to NotificationConfig.
Use the configureNotificationMetaData() to transfer the configuration to the SDK.
val moEngage = MoEngage.Builder(this, "XXXXXXXX")
.configureNotificationMetaData(NotificationConfig(R.drawable.small_icon, R.drawable.large_icon))
.build()
MoEngage.initialiseDefaultInstance(moEngage)
MoEngage moEngage = new MoEngage.Builder(this, "XXXXXXXXXX")
.configureNotificationMetaData(new NotificationConfig(R.drawable.small_icon, R.drawable.large_icon))
.build();
MoEngage.initialiseDefaultInstance(moEngage);
Ensure that the SDK is initialized with the metadata in the onCreate() of the Application class for push notifications to work.
| info |
Notification Icon Guidelines
|
Notification Small Icon Density, Size
| Density (dp) | Size (px) |
|---|---|
|
MDPI |
24x24 |
|
HDPI |
36x36 |
|
XHDPI |
48x48 |
|
XXHDPI |
72x72 |
|
XXXHDPI |
96x96 |
| warning |
Critical Please ensure the small icon is set. If the small icon is not set, notifications will not be displayed. |
Stacking Notifications (optional)
By default, Android replaces an old notification with a new one from your application. If you want to show multiple notifications from your app stacked in the notification drawer, you can enable this feature.
To enable stacked notifications, set isMultipleNotificationInDrawerEnabled to true in the NotificationConfig during the SDK initialization.
Refer to the notification config for additional options.
val moEngage = MoEngage.Builder(this, "XXXXXXXX")
.configureNotificationMetaData(NotificationConfig(R.drawable.small_icon, R.drawable.large_icon, R.color.notiColor, true))
.build()
MoEngage.initialiseDefaultInstance(moEngage)
MoEngage moEngage = new MoEngage.Builder(this, "XXXXXXXXXX")
.configureNotificationMetaData(new NotificationConfig(R.drawable.small_icon, R.drawable.large_icon, R.color.notiColor, true)
.build();
MoEngage.initialiseDefaultInstance(moEngage);
| info |
Information If you do not need to set a specific color for the notification, pass -1 to use the system default. |