Search code examples
androidpush-notificationandroid-c2dm

Push Notification for android PHP script not working?


I have developed the android application for Android. And also i developed a PHP script for send the notification to mobile device.

The script is running successfully and send message but my android device doesn't receive the notification.

Please any one help me to send the notification to my device


Solution

    1. You need to check on the server what HTTP response you are getting from the Google servers. Make sure it is a 200 OK response, so you know the message was sent. If you get another response (302, etc) then the message is not being sent successfully.

    2. You also need to check that the Registration ID you are using is correct. If you provide the wrong Registration ID (as a destination for the message - specifying the app, on a specific device) then the Google servers cannot successfully send it.

    3. You also need to check that your app is successfully registering with the Google servers, to receive push notifications. If the registration fails, you will not receive messages.

    This tutorial provides a lot of clarity about C2DM, and include sample code. http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html