|Push Notification Service||Android Devices|
This article will explain how we can get additional information from the payload, other than the "message" string. Sometimes, it isn't clear to us how to retrieve arbitrary attributes from the GCM payload and whether the answer relates to the tags framework.
The extra data that you supply with your push payload is available in the bundle that is passed to the onReceiveMessage method in your implementation of the GCM (Google Cloud Messaging) Service. You provide this data in the message->custom->Android object in the payload that you POST to the v1/push API. Each key and value is copied to a key and value with the same key name in your bundle.
An example is shown below:
If you POST the following payload to the v1/push API:
"my_custom_key_1" : "value1",
"my_custom_key_2" : "value2",
Then the bundle that is passed to the onReceiveMessage will have two keys, "my_custom_key_1" and "my_custom_key_2".
Note: You should think about tags as topics that people can subscribe to. For example, if you have a news app, you could have different topics (tech, music, movies, business) that people could subscribe to so that, you could target people by topics when sending pushes (for example, there is a new article in the movie section).