Overview
The Notification Center shows your push notification history, allowing you to provide an option for the end-user to scroll back and see what they have missed. MoEngage provides out-of-box inbox support with a fully customizable default UI and also provides an option to build your own Notification Center.Using MoEngage’s default Notification Center
SDK Installation
Installing using BOM
Integration using BOM is the recommended way of integration; refer to the Install Using BOM document. Once you have configured the BOM add the dependency in the app/build.gradle file as shown belowNote: Version numbers are not required for these dependencies; the BOM automatically manages them..
Adding the default Notification Center to your app
To use the default Notification Center UI you can either launch the Activity provided by the SDK or add the Fragment provided by the SDK.Use Activity
The activity is already declared in the SDK’s manifest file and can be inflated using the below code.Use Fragment
You can embed InboxFragment provided by the SDK in your app’s activity. For information on how to add a Fragment to an Activity, refer to Google documentation on Fragments.Adding parent Activity to the inbox.
Optionally if you want to define the parent activity for the Inbox then use the below code. Replace [PARENT_ACTIVITY_NAME] with the name of the parent activity.Customizing Default Notification Center
SDK provides a certain set of UI customization options. The InboxActivity is already in the SDK’s manifest file, if a change in label/theme of the default activity is required the activity should be declared again in your app’s manifest file and override the attributes.Activity Label customization
The default label for the Inbox Activity is Notification Inbox, which you can override by declaring the moe_inbox_notification_title in the strings.xml of your application.Activity theme
To customize the theme, you can either re-declare the activity in your app’s manifest and provide the desired theme, or you can override the SDK defaults as described below. The default theme applied to InboxActivity is MoEInboxTheme.NoActionBar. You can declare a theme with the same name in the application’s style.xml or themes.xml or equivalent file. Below is the definition of the default theme- Toolbar Style
- Message Text Appearance
- Header
- Message
- Timestamp
- Scrollbar style
- Empty Notification Center style
InboxAdapter Customization
You can override InboxAdapter to customize the look and feel of the notification Items.In case of using a custom InboxAdapter, the app should make sure to invoke InboxListAdapater.onItemClicked() on the message item click for the SDK to handle the notification click action; otherwise, the click event will not be tracked, and the on click action will not be executed.
Advanced customization options
-
Deleting Notification from Notification Center
You can delete a particular notification from Notification Center by calling deleteItem().
- Custom notification item click handling
Self Handled Notification Center
MoEngage SDK provides helper APIs to fetch the relevant inbox data to display, track events, delete messages, etc. that can be used to build your Notification Centre.SDK Installation
Installing using Catalog
Integration using a Version Catalog is the recommended way of integration. Once you have configured the catalog, add the dependency in the app/build.gradle file as shown belowBuild Your Notification Center
The below helper APIs can be used to build your own Notification Center. For more information on available helper APIs refer here.Get all messages
Get UnClicked Notifications count
Track Inbox Notification Clicks
Delete Inbox Message
Delete All Inbox Message
This feature requires a minimum catalog version 4.5.0.