Reputation: 1
i am trying to send notifications via gcm to my android device. The registration was successful and i have the reg id saved on my server. When i send a test notification and keep my phone for debugging, the onReceive method is triggered in the demo app which means that the notification arrived. But, the intent also has the bundle - Error:SERVICE_NOT_AVAILABLE, message_type = send_error, google.message_id = 1
Could anyone tell me what might be the problem here?
Thanks,
Nitin
Edit: As it turned out, there was a problem with the firewall which was blocking the port at my office. Works fine at home. Thanks!
Upvotes: 0
Views: 413
Reputation: 26007
To know that your device has been registering, I supose you might be checking it in onRegistered function. Similarly, I think for receiving a message on your device you need to override ans use the onMessage() function in a class that extends GCMBaseIntentService
. Something like:
protected void onMessage(Context context, Intent message) {
Log.d("GCMIntentService","Received push message");
Bundle extras=message.getExtras();
for (String key : extras.keySet()) {
Log.d("GCMIntentService", "Received key: " +key +" and value as: "+extras.getString(key));
}
Hope this helps.
Upvotes: 1