All Collections
Campaign Edition & Analytics
Message Edition
How can I add a notification badge to my app icon?
How can I add a notification badge to my app icon?

Notifications badges are handy to let your users know they have an unread push notification.

Baptiste avatar
Written by Baptiste
Updated over a week ago

Android

On Android (8.0 and higher), notification badges (or "notification dots") are automatically displayed on your app icon when users have unread push notifications. Users can long-press on the app icon to see the list of unread notifications.

Android's notification badges are simple coloured dots. This doesn't allow users to know how many unread push notifications they have for a specific app. Some device manufacturers may add an unread notifications count to their custom Android interfaces (e.g. Samsung, Xiaomi, etc). When it is the case, the system will increment or decrement the value displayed on each app icon automatically.

iOS

Batch allows you to display a badge in the top right corner of your iOS app icon when your users receive a new notification. Here is how it looks:

Badge counts are especially useful to show your users that new content is available in your app. This is a simple way to re-engage users and create more visits in a non-intrusive way. 

Customers on paid plans can add a badge to their notifications on iOS:

  • From the Dashboard,

  • Via the Transactional or Campaigns API.

From the Dashboard

You set a badge count (e.g. 99) by copying/pasting the following code in Advanced settings > Custom payload:

{"aps":{"badge":99}}

Using the Campaigns/Transactional APIs

This can be easily achieved by adding the exact same code to the custom_payload field. Here is how it looks for a new campaign:

{
  "name": "Test Campaign",
  "push_time": "now",
  "live": true,
  "messages": [
    {
      "language": "en",
      "title": "Hello!",
      "body": "How's it going?"
    }
  ],
  "custom_payload": "{\"aps\":{\"badge\":2}}"
}

Incrementing the badge value

iOS allows you to set a specific value for the badge count (e.g. 0, 3, 99) but doesn’t provide any mechanics to automatically increment or decrement the value displayed on your app icon when a notification is received.

You could handle that issue by saving remotely the most recent value of the badge for each install, and resetting it once the app is opened. We usually recommend against it as the badge may be reset while the device is offline.


This article belongs to Batch's FAQ. Need more help? Find insightful articles, documentation, case & market studies, guides, and even more in our website's Resources section on batch.com and our blog.

Did this answer your question?