Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android "hello world" pushnotification example [closed]

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

  1. Google is sending notification using our "device id" right ?
  2. Is there any code needed in our application other than adding some permission in out manifest for receiving notification ?
  3. We have to register user's device id to "local database" in order to send notification am I ?

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

like image 963
ramesh Avatar asked May 05 '13 16:05

ramesh


People also ask

How do I send push notifications on Android?

Navigate to Settings > Mobile Apps. Click the mobile app for which you'd like to send a push notification. For Device Token, enter the token you located above. For Message, enter a message to display in the push notification.


1 Answers

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:

  1. To send a notification you send the data(message) with the registration id of the device to https://android.googleapis.com/gcm/send. (use curl in php).
  2. To receive notification and registration etc, thats all you will be requiring.
  3. You will have to store the registration id on the device as well as on server. If you use GCM.jar the registration id is stored in preferences. If you wish you can save it in your local database as well.
like image 120
Anirudha Agashe Avatar answered Sep 29 '22 08:09

Anirudha Agashe