使用setGroupSummary(true)的通知在Android N中是不可见的。

时间:2021-03-16 22:50:29

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.

尝试以集群格式显示3个通知。根据doc,我添加了第一个通知的setGroupSummary(true)属性。但在结果中,我只有两个通知。添加GroupSummary属性的通知不可见。

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,使用setGroupSummary(true)的通知在Android N中是不可见的。

结果是,

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

我希望在不遗漏的情况下,以集群格式显示所有三个通知。

Any help will be really appreciated.

非常感谢您的帮助。

2 个解决方案

#1


1  

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

您应该检查以下答案:setgroup()在通知中不工作。

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.

您必须创建一个单独的组通知,并将组摘要标志设置为true,而这将成为绑定其他通知的父通知,该通知在其内部包含相同的组键。

#2


0  

Android 7 makes a decision regarding summary notification is shown by itself. So, you want see it unless system decides that it needs to be displayed.

Android 7做了一个关于总结通知的决定。所以,你希望看到它,除非系统决定它需要显示。

Solution: create a dedicated summary notification.

解决方案:创建一个专用的汇总通知。

#1


1  

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

您应该检查以下答案:setgroup()在通知中不工作。

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.

您必须创建一个单独的组通知,并将组摘要标志设置为true,而这将成为绑定其他通知的父通知,该通知在其内部包含相同的组键。

#2


0  

Android 7 makes a decision regarding summary notification is shown by itself. So, you want see it unless system decides that it needs to be displayed.

Android 7做了一个关于总结通知的决定。所以,你希望看到它,除非系统决定它需要显示。

Solution: create a dedicated summary notification.

解决方案:创建一个专用的汇总通知。