Pages

Label

Jumat, 18 Januari 2013

Android Push Notifications using Google Cloud Messaging (GCM)


  At first What is Push Notifications?
It is type of notification which comes from server to android device and it informs user automatically that some information have come from server. So you(user)have to open it and get the detail.
Now coming on topic
Google provides a service named Google Cloud Message (GCM) which allows developers to send data to their applications running on Android devices.
Unlike most solutions which involve polling some server, this service is a "push" service (similar to SMS messages).

GCM replaces the previous service named C2DM. This framework is a modified version of the previous C2DM framework that works with the new service.
Note that new GCM service is simpler than C2DM and doesn't require a special approval from Google.
How to use it ?
You(Developer) should implement three components in order to use this service.

 Client code- The client code which is responsible for registering the specific device and application with Google service and is responsible for handling new messages that arrive.

Web server- When the device registers with Google service it receives a registration id that allows you, the account holder, to send messages to your application running on the user device. The device needs to send this id to a web server that you can access.

Messages sending tool - This is a command line tool that is responsible for fetching the user id from the web server and then sending the message to the device. This is done by sending a request to Google servers.

Reference:-
For more understanding and detail you can visit this  official link. GCM Architectural Overview | Android Developers

Working Flow of GCM
here I am discussing a rough flow  of GCM push Notification:-
1st. 
Android Phone  send it Application id and Sender id  to GCM server for registration.
2nd.
After successful registration GCM server issued  Registration id to Android device. 
3rd
After getting Registration id Android Device sends  it to our server. 
4th
Our Server stored this Registration id  into Data Base for Future Use. 
5th
Now Notification Message.
Whenever Push Notification needed  Our Server send a message to GCM server with Registered Id(i.e stored in our data base).
  After receiving message GCM server sends it to respective Registered Device(by using registration id).  







0 komentar:

Posting Komentar

 
[tutup]