Title: How do I delete a downstream message via the HTTP connection server API?
Tags: google-cloud-messaging
Question: I'm sending downstream messages via GCM's HTTP connection server API. The notification payload includes a tag that I'd like to use to delete the delivered notification on the registered Android/iOS device. Is this possible?



Here is another answer: Of course yes. 

All you have to do is to handle the deleting procedure client side.

e.g. on android ```OnMessageReceived``` 


Detect if the received notification contains the delete tag. 
Delete the desired notification by ```notificationManager.cancel(NOTIFICATION_ID)``` or all of them by ```notificationManager.cancelAll()```


Comment for this answer: Notifications are handled by the platform (Android in this case). Once the GCM message is received by the device, the processing of the notification is totally up to the client side GCM (the service) plays no further role. Ali is right you need to handle this client side.
Comment for this answer: @Yaniv yes, you may use FLAG_AUTO_CANCLE
Comment for this answer: Of course this is not related to HTTP  or XMPP. it is just an automatic cancel,  which you have to do cliend side. As far as I know there is no way to remove a delivered message server side,  you can only put a `collapsible-key` to replase not-delivered messages.
Comment for this answer: Is it at all possible to do so via the server API rather than require this handling in the clients?
Comment for this answer: For instance, it is possible that the root cause behind a notification might no longer hold true, thereby invalidating the notification itself and requiring it to be deleted. And all this might happen before the client is even opened on the device. I would rather not send data payload since that would require additional processing on the device...
Comment for this answer: I don't believe this is something that can be done with GCM's HTTP or XMPP connection server API.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:10/25/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<google-cloud-messaging>', 'Title': 'How do I delete a downstream message via the HTTP connection server API?', 'ViewCount': 57, 'id': 33331338, 'user_AboutMe': None, 'user_AccountId': 7183101.0, 'user_DisplayName': 'Yaniv', 'user_Reputation': 11.0, 'user_Views': 2.0, 'user_id': 5486218.0}}