Quicky Post: Troubleshooting Receiving Push Notifications using Android Eclipse

Preview/Draft

Sometimes I like to fire off information without making it pretty in hopes it will help someone struggling with an issue.  So… I apologize up-front for the brevity of this post and promise to incorporate it into a larger troubleshooting blog when I get a chance to breathe Smile

Issue

I confirmed Windows Azure Mobile Services was able to communicate with GCM (Google Cloud Messaging) and had no errors sending the notification to GCM.  But how could I see how this got or didn’t get to my Android Emulator?

Server side

I was able to confirm that there were no errors by dumping out the result of doing a push.gcm.send using this script (from our tutorial):

 push.gcm.send(item.handle, item.text, {
    success: function (response) {
        console.log('Push notification sent: ', response);
    }, error: function (error) {
        console.log('Error sending push notification: ', error);
    }
});

And opening the LOGS tab saw this result:

Push notification sent: {

multicast_id: 4877295250689814000,

success: 1,

failure: 0,

canonical_ids: 0,

results: [

{ message_id: '0:1392395679428889%0d284a0ef9fd7ecd' } ], invalidIds: [], updatedIds: {} }

So how to see what if anything is happening on the client?  The message_id looks promising!

Client side

Running the program from Eclipse and ensuring Log Cat is running I was able to confirm that I am getting the message from the GCM service!

02-14 11:34:39.769: I/GCM(624): GCM message com.example.jsanderspushgcm 0:1392395679428889%0d284a0ef9fd7ecd

I clicked on the message to set up a verbose filter for GCM:

image

And now I can easily filter and see what GCM logs are showing me!

Conclusion

I could also use fiddler as a proxy to see network traffic but with a little logging and knowledge of the available server and client side tools, was able to correlate the GCM messages quickly!

Let me know if this was useful to you!