Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notification with setGroupSummary(true) is not visible in Android N

Tried to show 3 notification in cluster format. As per the doc, I added the setGroupSummary(true) property for the first notification.But in the result i have got only two notification. The notification which is added the GroupSummary property is not visible.

NotificationCompat.Builder firstNotification = createNotification(context,"1.Message","Here you go 1");
firstNotification .setGroupSummary(true);
firstNotification .setGroup("KEY_NOTIFICATION_GROUP");
NotificationCompat.Builder secondNotifi = createNotification(context,"2.Message","Here you go 2");
secondNotifi .setGroup("KEY_NOTIFICATION_GROUP");           
NotificationCompat.Builder thirdNotifi= createNotification(context,"3.Message","Here you go 3");
thirdNotifi.setGroup("KEY_NOTIFICATION_GROUP");

Here the notification trigger,

notificationManager =   (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0,firstNotification .build());
notificationManager.notify(1,secondNotifi .build());
notificationManager.notify(2,thirdNotifi.build());

And the result is,enter image description here

I want to show all three notification in the cluster format without missing.

Any help will be really appreciated.

like image 354
Srinivasan Avatar asked Jun 29 '16 10:06

Srinivasan


People also ask

How do I get notification stacks on Android?

To create a stack, call setGroup() for each notification you want in the stack and specify a group key. Then call notify() to send it to the wearable. final static String GROUP_KEY_EMAILS = "group_key_emails"; // Build the notification, setting the group appropriately Notification notif = new NotificationCompat.

How do I show notifications on Kotlin?

In this class, clicking the button calls the addNotification() method where we implement the NotificationCompat. Builder object to set the notification properties. The NotificationManager. notify() method is used to display the notification.


1 Answers

You should check the following answer : setgroup() in notification not working

You have to create a separate group notification and set the group summary flag true only for that, and that becomes the parent notification that bundles other notifications with the same group key within itself.

like image 121
Ayush Chaturvedi Avatar answered Nov 15 '22 04:11

Ayush Chaturvedi