I try to implement GCM in my project and have problems with onMessage function. According to the examples, I write:
@Override
protected void onMessage(Context arg0, Intent arg1) {
// TODO Auto-generated method stub
Log.d("GCM", "RECIEVED A MESSAGE: " + arg1.getStringExtra("message"));
// other part of the code goes here...
}
Well, and I get errors with this getStringExtra - it seems this intent doesn't contain it. I do receive onMessage event, that's for sure. I just get errors when try to get actual message. My server receives:
{"multicast_id":7888157947681629492,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1348246306435688%196553bef9fd7ecd"}]}
The GCM convention is: a value that you supply on sending as "data.foo" will be delivered as an intent extra called "foo". Are you putting "data.message" into the POST data block on the server?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With