# How to add a notification badge to your app icon?

## Android <a href="#h_9c6186342e" id="h_9c6186342e"></a>

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.

<figure><img src="https://509463063-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfiAYaWDWqtFZeXxyg67F%2Fuploads%2FsPfDME7QGagnHeyTnWdO%2FBadge1.png?alt=media&#x26;token=1d635612-2058-410c-a9b2-b7ae82adee6a" alt=""><figcaption></figcaption></figure>

Android's notification badges are simple **colored dots**. This doesn't allow users to know how many unread push notifications they have for a specific app.&#x20;

{% hint style="info" %}
Some device manufacturers may add an unread notifications count to their custom Android interfaces (e.g. Samsung, Xiaomi, etc). When this is the case, the system will increment or decrease the value displayed on each app icon automatically.
{% endhint %}

## iOS <a href="#h_c313df66f0" id="h_c313df66f0"></a>

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:

<figure><img src="https://509463063-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfiAYaWDWqtFZeXxyg67F%2Fuploads%2FNEOrVfRRPlcMMAEAN3kW%2FBadge2.jpg?alt=media&#x26;token=773ff91b-04a9-4b59-af8c-6f0069fd782d" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
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.**
{% endhint %}

You can add a badge to your notifications on iOS:

* **From the Dashboard**
* **Via the Transactional or Campaigns API**.

## From the Dashboard <a href="#h_62f2fc5bf2" id="h_62f2fc5bf2"></a>

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

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

<figure><img src="https://509463063-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfiAYaWDWqtFZeXxyg67F%2Fuploads%2Fgrxf4FVL0uciixrzCUHI%2FCleanShot%202025-05-07%20at%2011.19.09.png?alt=media&#x26;token=e7fa1c65-20ef-45be-aec7-e2c9d711832d" alt=""><figcaption></figcaption></figure>

## Using the Campaigns API <a href="#h_3e96d86919" id="h_3e96d86919"></a>

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

```
"messages": [
    {
      "channel_type": "push",
      "platform_type" : ["ios","android"],
      "title": "The campaign title",
      "body": "The campaign body",
      "ios": {
        "deep link": "https://example.com/",
        "custom_payload": "{\"aps\":{\"badge\":2}}"
      "android": {
        ...
      }
    }
  ]
```

Find more information on how to use our API in the [dedicated documentation](https://doc.batch.com/developer/api/cep/campaigns).

## Incrementing the badge value <a href="#h_6221a8cf82" id="h_6221a8cf82"></a>

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.

{% hint style="warning" %}
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.
{% endhint %}
