How can I receive multiple notifications by using GCM without replacing the precedent one?

后端 未结 2 469
天命终不由人
天命终不由人 2021-02-18 17:57

I\'m working on a project which receive notification from GCM server.

I\'ve got the registration ID from GCM server and i send it to my server application which save it

相关标签:
2条回答
  • 2021-02-18 18:24

    You need to make sure that the value of the 'collapse_key' field in each message is different

    0 讨论(0)
  • 2021-02-18 18:30

    The collapse key is relevant only to messages that were sent to the GCM server but haven't reached the destination device yet (if more than one such message has the same collapse key, only one of them will be sent to the device when it becomes online).

    In your question you describe a different situation - the first message is received by the device and then the second message is received by the device and replaces the original message. That has nothing to do with GCM. It has to do with the way your application handles the received messages. For example, if your application code that receives the message displays is as a notification, it's up to you to decide whether a new message will override the existing notification or create a new notification.

    0 讨论(0)
提交回复
热议问题