Android Oreo: grouped notifications with notification channels

I have completed the documentation below and can successfully create a notification group on Android N and higher. However, the problem is with Android Oreo, each notification sent to a group plays a sound for the group.

This is annoying because I just wanted the sound to play once. Each individual notification is a summary of the chats that the user has not read for each chat room in which they are located. I need grouping when there are several chats with unread messages.

There seems to be no way to adjust the sound for notification dynamically, it is limited to creating a channel.

I tried to follow what Dan Liu suggested here , but the notification sound is played for each notification.

So my question is, how do you get a grouped notification in Android Oreo without sound notifications for everyone?

+4
source share
1 answer

I worked all week trying to solve it, but soon I will find the answer by asking about StackOverflow lol.

The answer comes back courtesy of Dan Liu again, but I had to call

  notificationBuilder.setGroupAlertBehavior(Notification.GROUP_ALERT_SUMMARY) 

for notifications to children.

More information can be found here .

+2
source

Source: https://habr.com/ru/post/1695003/


All Articles