I followed the documentation provided here and can successfully create a notification group on Android N and higher. The issue I'm having however, is with Android Oreo, each notification posted to the group plays the sound for the group.
This is annoying because I'd just like the sound to play once. Each individual notification is a summary of the chats the user hasn't read for each chat room they're in. I need the grouping for when there are multiple chat rooms with unread messages.
There doesn't seem to be a way to set the sound for a notification dynamically, it's limited to channel creation.
I tried following what Dan Lew suggested here but the notification sound plays for each notification still.
My question therefore is, how do you get grouped notification in Android Oreo without having a notification sound play for each?
Create a new notification with a description of the group—often best done with the inbox-style notification. Add the summary notification to the group by calling setGroup() . Specify that it should be used as the group summary by calling setGroupSummary(true) .
To create a stack, call setGroup() for each notification you want in the stack and specify a group key.
Set the unique id to let Notification Manager knows this is a another notification instead of same notification. If you use the same unique Id for each notification, the Notification Manager will assume that is same notification and would replace the previous notification.
I'd been working for the entire week trying to solve it, but I find the answer shortly after asking on StackOverflow lol.
The answer comes courtesy of Dan Lew again, but I needed to call
notificationBuilder.setGroupAlertBehavior(Notification.GROUP_ALERT_SUMMARY)
on the children notifications.
More detail can be found here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With