Skip to content

Most visited

Recently visited


Notification Badges

Android O introduces functionality for displaying notification badges on app icons in supported launchers. Notification badges show notifications associated with one or more notification channels in an app, which the user has not yet dismissed or acted on. Notification badges are also known as notification dots. Users can turn off badges for notification channels or apps from the Settings app.

Notification badges displaying on a variety of launcher icons and a

Figure 1. Notification badges display on icons and folders.

Users can also long-press on an app icon to glance at the notifications associated with a notification badge in supported launchers. Users can then dismiss or act on notifications from the long-press menu in a similar way to the notification drawer.

A long-press menu displays a summary of notifications for an app.

Figure 2. Users can long-press on an app icon to glance at notifications.

Note: To learn how to implement notification channels, see the Notification Channels guide.

By default, each new notification in a channel increments the number displayed on the associated launcher long-press menu by one. After a user dismisses a notification or triggers a related action, that number decrements to reflect the change. You can override the count displayed in the long-press menu as a result of a notification. For example, you can set the value for the number of incoming messages to display in a long-press menu when creating a notification for a messaging app. To learn how to override the count displayed in the long-press menu, see Adjusting notification badges.

A long-press menu displays a custom count of notifications for an

Figure 3. You can override the notification count displayed in the long-press menu.

A folder's notification badge indicates the presence of notification badges for one or more of the apps inside the folder.

Caution: Don't badge every notification, as there are cases where badges don't make sense. Consider the following examples when planning to create notifications in a notification channel for your app:

  • Ongoing notifications: Most ongoing notifications, such as image processing, media playback controls, or current navigation instructions, don't make sense as a badge.
  • Calendaring apps: Avoid badging events occurring at the current time.
  • Clock or alarm apps: Avoid badging notifications related to current alarms.

Note: If you don't target Android O, your app displays a badge to indicate the presence of any notifications posted by your app.

Adjusting notification badges

By default, each notification channel reflects its active notifications in your app's launcher icon badge. You can use the setShowBadge() method to stop the presence of notifications from a channel being reflected by a badge. You can't programmatically modify this setting for a notification channel after it's created and submitted to the notification manager.

Note: Users can turn off badges for notification channels or apps from the Settings app at any time.

The following sample code illustrates how to hide badges in association with notifications from a notification channel:

NotificationManager mNotificationManager =
        (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// The ID of the channel.
String id = "my_channel_01";
// The user visible name of the channel.
CharSequence name = getString(R.string.channel_name);
// The user visible description of the channel.
String description = getString(R.string.channel_description);
int importance = NotificationManager.IMPORTANCE_LOW;
NotificationChannel mChannel = new NotificationChannel(id, name, importance);
// Configure the notification channel.

You can call Notification.Builder.setNumber() to set a custom number to display in the long-press menu of an app in supported launchers, as illustrated by the following sample code for a messaging app:

mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
int notificationID = 1;
String CHANNEL_ID = "my_channel_01";
// Set a message count to associate with this notification in the long-press menu.
int messageCount = 3;
// Create a notification and set a number to associate with it.
Notification notification = new Notification.Builder(MainActivity.this)
        .setContentTitle("New Messages")
        .setContentText("You've received 3 new messages.")
// Issue the notification.
mNotificationManager.notify(notificationID, notification);

The long-press menu displays the large or small icon associated with a notification if available. By default, the system displays the large icon, but you can call Notification.Builder.setBadgeIconType() and pass in the BADGE_ICON_SMALL constant to display the small icon.

If your app creates a notification that duplicates a shortcut, you can temporarily hide the shortcut while the notification is active. To hide a shortcut while a notification is active, call Notification.Builder.setShortcutId() and pass the ID of the shortcut. For more information on shortcuts, see App Shortcuts.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.