Google Cloud Messaging - is there a way to see list of all sent (or queued) notifications?

1k views Asked by At

We have a strange issue: We use PushSharp to send out notifications to Android devices, and the logs say Notification sent, but none are received on the device. If I change the Registration ID (replacing a character with something else), I do get "Invalid token" error, so I believe my requests make it to the server.

I'm wondering if there is a way to see a log of all sent (and/or queued) notifications somewhere on Google server, or if it's possible to enable such logging.

Basically - How can I troubleshoot notification delivery?

2

There are 2 answers

1
Eran On BEST ANSWER

The GCM server returns a response for each message you send to it. That message tells you whether the message was accepted or rejected by the server (it doesn't tell whether it was actually delivered to the device), and also specifies the type of error if any.

PushSharp probably reads this response and notifies about errors (such as the "Invalid token" error you got when you used an invalid registration ID).

If you don't see any errors, the problem is probably in your client application (either in the manifest or in the code that receives the GCM messages).

1
avs099 On

well, actually it turns out to be tricky. As per PushSharp documentation I was using the following code to send notifications:

push.QueueNotification(new GcmNotification().ForDeviceRegistrationId("DEVICE REGISTRATION ID HERE")
                      .WithJson(@"{""alert"":""Hello World!"",""badge"":7,""sound"":""sound.caf""}"));

and that was a mistake :) Google needs me to use "message" and "title" fields for notification body message and title respectively. As soon as I changed code to the following, it started to work:

push.QueueNotification(new GcmNotification().ForDeviceRegistrationId("DEVICE REGISTRATION ID HERE")
                      .WithJson(@"{""message"":""Hello World!"",""title"":""your app name""}"));