Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rollback/cancel the android-gcm notification

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 message in web before coming online in mobile, the GCM request should be rolled back. And user should not see the notification in mobile.

like image 882
Raghav Avatar asked Jul 25 '13 17:07

Raghav


People also ask

Can you cancel push notifications?

Touch and hold the notification, and then tap Settings . Choose your settings: To turn off all notifications, turn off All notifications. Turn on or off notifications you want to receive.

How do you dismiss a notification on Android?

To dismiss a notification, touch it and swipe left or right. Tap the dismiss icon to dismiss all notifications. On newer versions of Android, you can manage some notifications from the lock screen. Double-tap a notification to open the app or swipe left or right to dismiss the notification.

How does GCM push notification work?

The first step in GCM is that a third-party server (such as an email server) sends a request to Google's GCM server. This server then sends the message to your device, through that open connection. The Android system looks at the message to determine which app it's for, and starts that app.

How do I turn off push notifications in Swift?

How to Disable Push Notifications on Android. You can disable push notifications on Android by going into the Settings > Notifications options. Similar to iOS, Android lets you turn off push notifications for individual apps or use a 'Do not disturb' mode.


1 Answers

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.
like image 145
Eran Avatar answered Sep 25 '22 02:09

Eran