Reputation: 315
I am working on an application and implemented push notifications for that.
Previously everything was working fine. In the onMessage()
method of GCMIntentService
class, I was getting the message in the format like this:
{
"collapse_key": "null",
"time_to_live": 108,
"delay_while_idle": true,
"data": {
"message": "Hello android",
},
"registration_ids":["4", "8", "15", "16", "23", "42"]
}
This is what I am sending from my server, and was able to parse it properly. I mean intent of onMessage()
contained "data","registration_ids"...
But my problem occurs now - I am not getting the message in the format :
"data": {
"message": "Hello android",
},
Instead I am getting a value only for "message", no value for "data". It's null.
Upvotes: 4
Views: 4683
Reputation: 3681
My suggestion is that you put everything you need inside the "message" key because that's all you'll be getting. When you receive the message you can parse it back with your own structure. Hope it helps.
Upvotes: 2
Reputation: 393851
You should be getting only the keys contained within the data dictionary and their values. So in your case, message is all you should get.
Upvotes: 1