Skip to content

Most visited

Recently visited


Create a Group of Notifications

Starting in Android 7.0 (API level 24), you can display related notifications in a group (previously called "bundled" notifications). For example, if your app shows notifications for received emails, you should put all notifications into the same group so they can be collapsed together.

To support older versions, you can also add a summary notification that appears alone to summarize all the separate notifications—this is often best done with the inbox-style notification.

Figure 1. A collapsed and expanded notification group

You should use notification groups if all of the following conditions are true for your use case:

If your notifications don't meet the above criteria, you should instead consider updating an existing notification with new information or create a message-style notification to show multiple updates in the same conversation.

Create a group and add a notification to it

To create a notification group, define a unique identifier string for the group. Then, for each notification you want in the group, just call setGroup(), passing the group name. For example:


Notification newMessageNotification = new NotificationCompat.Builder(MainActivity.this, CHANNEL_ID)

By default, notifications are sorted according to when they were posted, but you can change order by calling setSortKey().

If alerts for a notification's group should be handled by a different notification, call setGroupAlertBehavior(). For example, if you want only the summary of your group to make noise, all children in the group should have the group alert behavior GROUP_ALERT_SUMMARY. The other options are GROUP_ALERT_ALL and GROUP_ALERT_CHILDREN.

Set a group summary

On Android 7.0 (API level 24) and higher, the system automatically builds a summary for your group using snippets of text from each notification. The user can expand this notification to see each separate notification, as shown in figure 1. To support older versions, which cannot show a nested group of notifications, you must create an extra notification that acts as the summary. This appears as the only notification and the system hides all the others. So this summary should include a snippet from all the other notifications, which the user can tap to open your app.

To add a group summary, proceed as follows:

  1. Create a new notification with a description of the group—often best done with the inbox-style notification.
  2. Add the summary notification to the group by calling setGroup().
  3. Specify that it should be used as the group summary by calling setGroupSummary(true).

For example:

//use constant ID for notification used as group summary
int SUMMARY_ID = 0;

Notification newMessageNotification1 =
    new NotificationCompat.Builder(MainActivity.this, CHANNEL_ID)
        .setContentText("You will not believe...")

Notification newMessageNotification2 =
    new NotificationCompat.Builder(MainActivity.this, CHANNEL_ID)
        .setContentText("Please join us to celebrate the...")

Notification summaryNotification =
    new NotificationCompat.Builder(MainActivity.this, CHANNEL_ID)
        //set content text to support devices running API level < 24
        .setContentText("Two new messages")
        //build summary info into InboxStyle template
        .setStyle(new NotificationCompat.InboxStyle()
                .addLine("Alex Faarborg  Check this out")
                .addLine("Jeff Chang    Launch Party")
                .setBigContentTitle("2 new messages")
        //specify which group this notification belongs to
        //set this notification as the summary for the group

NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
notificationManager.notify(emailNotificationId1, newMessageNotification1);
notificationManager.notify(emailNotificationId2, newMessageNotification2);
notificationManager.notify(SUMMARY_ID, summaryNotification);

The summary notification ID should stay the same so that it is only posted once, and so you can update it later if the summary information changes (subsequent additions to the group should result in updating the existing summary).

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


Suivez Google Developers sur WeChat

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 short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)