Enable badge for Android.
If badge is enabled for an Android app, Acoustic Campaign sends badge counts to devices when a new inbox message is created.
A badge is aggregated according to the number value in the notification.
The app has 3 notifications in the notification bar and the number values are:
- Notification 1: number = 3
- Notification 2: number = 5
- Notification 3: no number set = 1 (number value automatically defualts to 1 because every new notification increases the badge number by 1.
In this case, the badge number is calculated together as 3 + 5 + 1 = 9. If a notification is removed, its number is subtracted from the aggregated sum.
For example, if notification 2 is removed, the new badge number will be 9 - 5 = 4.
Unlike iOS, in Android a badge number cannot be set without a notification. The badge number is always the aggregated sum of the application's notifications.
- The user must create a notification with number = [number of new inbox messages] to indicate that new inbox messages have arrived.
- Clicking on a notification opens the inbox and clears the application badge number.
- The badge number is set in the mce message payload.
- The badge attribute within the alert attribute sets the number.
To see notification badges in Android, the user must enable the notification dot (badge number) for the app, or for all notifications. A developer can enable the notification badge for the notification channel by calling setShowBadge(true).
Updated over 2 years ago