I'm using FCM to send notifications to Android devices. When the app is in background, if I send 10 notifications, the devices will show up 10 entries on the notification bar.
I want FCM to make only one entry on notification bar, i.e. the newer one will overwrite old ones. I don't find a key to set this at https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream.
Is there a way to do, or it is impossible? Thanks.
To achieve this, in your notification payload, use the tag key
Cheers.
It's possible. Two approaches.
First is you make use of the
collapse_key
parameter to set the message as a collapsible message. Referring to the FCM docs:It's actually included in the link you provided (first parameter under Options):
Second approach is Notification bundling/stacking/grouping. As per my answer here:
Update:
From one of the linked posts, using the
tag
parameter is also an option: