ToothlessGear / node-gcm

A NodeJS wrapper library port to send data to Android devices via Google Cloud Messaging
https://github.com/ToothlessGear/node-gcm
Other
1.3k stars 208 forks source link

Group notification #284

Closed ronaiza-cardoso closed 7 years ago

ronaiza-cardoso commented 7 years ago

Is there any way to group the notifications?

eladnava commented 7 years ago

You're probably looking for collapseKey.

This parameter identifies a group of messages (e.g., with collapse_key: "Updates Available") that can be collapsed, so that only the last message gets sent when delivery can be resumed. This is intended to avoid sending too many of the same messages when the device comes back online or becomes active.

More info here: https://developers.google.com/cloud-messaging/http-server-ref#table1

debjeetsarkar commented 7 years ago

@yesroh @eladnava collapsible messages are really useful for send-to-sync messages when you dont really want to bug your client side with a huge bunch of messages.

If the grouping talked about is like a single notification having all the previous downstream messages, the corresponding handling is to be done on the Android client side using the Notification.InboxStyle and binding the PNs based on a pre-defined key.

hypesystem commented 7 years ago

@debjeet-sarkar I agree, this sounds like a thing that should be solved client-side. I'm going to close the issue here.

@yesroh I hope you found the comments here at least slightly helpful, and hope you find the solution :-) (But it isn't a problem that node-gcm can solve for you.) Best of luck!