Skip to content

[Android] How to group notifications

Elvin (Tharindu) Thudugala edited this page Jun 5, 2024 · 6 revisions

From Version 5.0.1 and above

You can group notifications by setting NotificationRequest.Group and NotificationRequest.Android.IsGroupSummary

First, you must create the Summary notification

var notification = new NotificationRequest
{
    NotificationId = 100,
    Title = "Summary",
    Description = "Summary Description",
    Group = "example.GROUP_01",
    Android =
    {       
        IsGroupSummary = true
    }
};
LocalNotificationCenter.Current.Show(notification);

Then you can create child notification for the group

var notification = new NotificationRequest
{
    NotificationId = 200,
    Title = "Child 1",
    Description = "Child 1 Description",
    Group = "example.GROUP_01" 
};
LocalNotificationCenter.Current.Show(notification);

var notification = new NotificationRequest
{
    NotificationId = 300,
    Title = "Child 2",
    Description = "Child 2 Description",
    Group = "example.GROUP_01"   
};
LocalNotificationCenter.Current.Show(notification);