rollback/cancel the android-gcm notification

前端 未结 1 466
自闭症患者
自闭症患者 2021-01-18 02:31

Is there a way to rollback the notification request placed to GCM server?

As in, consider a GCM-message-request is placed to GCM server. If the user sees the messag

1条回答
  •  情歌与酒
    2021-01-18 02:50

    There is no built in mechanism for such rollback in the case you describe. You can try implementing it yourself - when your server notices the message was viewed in web, you can send another GCM message to the device with some data that represents a need to rollback. When you process that message, you should clear any notifications that were created by your app on that device (I'm not sure if that's possible, you'll have to check).

    There is such a mechanism in a similar case - if the user has multiple Android devices, and you send a GCM message to all of them (using the new user notifications feature), once the user views the notification on one device, it would be automatically removed from the other devices.

    • If a message has been handled on one device, the GCM message on the other devices are dismissed. For example, if a user has handled a calendar notification on one device, the notification will go away on the user's other devices.
    • If a message has not been delivered yet to a device and but it has been handled, the GCM server removes it from the unsent queue for the other devices.

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