Rollback / Cancel Android-gcm notification

Is there a way to cancel a notification request hosted on a GCM server?

As with the case, consider requesting a GCM message to the GCM server. If the user sees a message on the network before accessing the Internet on a mobile phone, the GCM request should be rolled back. And the user should not see the notification on the mobile phone.

+7
android push-notification google-cloud-messaging
source share
1 answer

In the described case, there is no built-in mechanism for such a rollback. You can try to implement it yourself - when your server notices that the message was viewed on the Internet, you can send another GCM message to the device with some data that represents the need for rollback. When you process this message, you should clear all notifications created by your application on this device (I'm not sure if this is possible, you will need to check).

In such a case, there is such a mechanism - if a user has several Android devices, and you send a GCM message to all of them (using new user notifications ), as soon as the user views the notification on one device, he will be automatically deleted from other devices.

  • If the message is processed on one device, the GCM message on the other devices is rejected. For example, if a user has processed a calendar notification on one device, the notification will be deleted on the user's other device.
  • If the message has not yet been delivered to the device, but it has been processed, the GCM server removes it from the unsent queue for other devices.
+1
source share

All Articles