I want to group notifications into a summary.
I achieve this by having a single ID for all notifications. This way android will not create new notifications but update the existing one (reduced code):
Notification summaryNotification = new NotificationCompat.Builder(this)
.setGroupSummary(true)
.setDefaults(Notification.DEFAULT_ALL)
.setStyle(new NotificationCompat.InboxStyle()
.addLine(msg)
.setBigContentTitle("My App")
.setSummaryText("FooBar"))
.build();
mNotificationManager.notify(uuid, summaryNotification);
UUID is always the same so that the notification should be updated. However when a new notification arrives, setStyle
seems to be overwritten.
This cause the old addLine(msg)
to disappear. However I want the new message to be added without having some kind of notification manager server side.
Any ideas or suggestions?