How to check whether your push notification/GCM message receive logic on app is working or not



In this post,I am not trying to teach the basics of GCM/push notification.You can easily get started with GCM from Android GCM. This post is for those developers who have

  • Successfully registered their device to GCM server and received GCM phone registration id
  • Implemented the logic to receive notification from their server
  • and are relying on back end developers to send test notification message


Frankly speaking I am writing this post out of frustration of dealing with back end developers who simply say that app logic is not right but back end is error proof.And they constantly force us to check our code. So,in this case if any back end developer say that their process of sending push notification to app is right and you also feel that your logic is right,then simply test your logic with HTTP post request.For this purpose I am using a Chrome app named Dev Http Client,which is BTW great great tool for any app developer doing REST API.I assume you have done the following

  1. Created a Google Project on Google API console
  2. Activated Google Cloud Messaging for Android service on that project
  3. Created an API key for that project,so that Google API can be accessed using this key
  4. And all the procedures I have described in above list


Now carefully look upon the following images

01_notification_format

01_notification_msg


So,on above image you see that you have to put

  1. Google API console API key on header
  2. Phone registration id on body part
  3. On data you have to put what kind of message you want to pass
  4. Press Send button to send the push notification


You can see the message response on second picture i.e. what have been sent by Google GCM server. So,if you receive the notification using above procedure,your app logic is right otherwise you have to make some changes. Further,to simply check whether your GCM/push notification receive logic is working or not,you don’t have to rely on back end developers,you can do on your own.

If you have any questions on this,feel free to ask me on comments.Till then Happy KitKat (as KitKat along with Nexus 5 was released yesterday) 😉

Advertisements

11 thoughts on “How to check whether your push notification/GCM message receive logic on app is working or not

  1. hi, i’m using .Net web service to send notifications to GCM and receiving these notifications from GCM server to android devices. Android device registration is successful, but i’m not able to receive any notifications sent to GCM server. GCM service is ON. I’m using correct API Key and SENDER ID too. On server side i can see message is sent to GCM server. But from GCM server to android, there is no communication

  2. Strnage thing is with your tool i get no response and asks if the certificate it correct. But when sending with a gcm.php file i do get send id back with succes:2. So it seems to send correct else i would not expect a positive message back from the gcm server. But…none of my test phones do get the message back. Any idea?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s