I am new to android application development and I am learning little bit. I am in a hard mission for sending push notification ( cloud messaging ) from my web server ( PHP ) to android application ( just a "helloworld" ). I did some "googling" and few of my doubts are
Please help me Plus can any one please show me a code sample or documentation for sending a simple notification from PHP server ?
Thanks in advance
This question is related to
android
push-notification
android-c2dm
Overview of gcm: You send a request to google server from your android phone. You receive a registration id as a response. You will then have to send this registration id to the server from where you wish to send notifications to the mobile. Using this registration id you can then send notification to the device.
Answer:
you can follow this tutorial
http://www.androidbegin.com/tutorial/android-google-cloud-messaging-gcm-tutorial/
it helped me to do a push notification; or you can follow this other tutorial
http://www.tutorialeshtml5.com/2013/10/tutorial-simple-de-gcm-traves-de-php.html
but it's in spanish but you can download the code.
GCM is being replaced with FCM
Have a look at developers.android.com - Google replaced C2DM with GCM Demo Implementation / How To
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.
Here is a good question you may should have a look at it: How to add a push notification in my own android app
Also here is a good blog with a really simple how to: http://blog.serverdensity.com/android-push-notifications-tutorial/
Source: Stackoverflow.com