Google cloud messaging


Published on

This is very useful to Android developers. I gave only short not on Google Cloud Messaging.

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Google cloud messaging

  1. 1. Google Cloud Messaging Sketch: Google cloud messaging (GCM) is a service given by google as a service for android developer to send data to their android applications. Likewise, send message from applications to server also possible using this service. Predominant characteristics of GCM:      Lightweight messages( up to 4kb of message) Don’t have any built in interfaces or libraries Third party servers send messages to their android application while registered with Google Cloud Server. Everything will authenticate like client app and server and all. Send same message to multiple devices at a time. Needs to configure for GCM: 1. Client Android Application: The GCM enabled android app which is higher that versions of Android 2.2 and need to be installed Google Play Store and need to be logged in at least one google account with that device. Or higher than the Android version of 4.0.4 (ICS). 2. Third Party Application Server: Any third party server that is registered with Google Cloud Server has to send their messages to them applications. 3. Google Cloud Server: Google Cloud Server involves sending message to android application which was sent by third party registered server. How it works: 1. A project id which was given by Google API console for these services is to identify the third party servers to send message using this id. Before that we need to switch on these services in cloud console like.
  2. 2. 2. Application Id that is to be registered android device has the rights to receive has messages from the server google server which is send by third party server. 3. API key that is given by the cloud server which is registered in third party server have rights to send message to their android applications. 4. Registration id for the android application issued by the Cloud Server sends that to third party server to identify their applications. Here are the diagram that how we got project id and API key from google cloud console.
  3. 3. How it is applied to Client App Application: The above is the way to register the android application to get the messages from third party server. 1. The first permission needed to be set to send registration id to third party server via Google cloud server. 2. The Application must have to log into one go google account. 3. This is used to keep devices processor from sleeping when the message is received. 4. To prevent other android application to registering and receiving messages from Google cloud server. 5. This permission is must like Application Package+ permission.C2DMESSAGE ion.C2DMESSAGE 6. Using this only android application registering with server and receiving messages.
  4. 4. Collapse key: Collapse key is set as true to the old message is deleted instead of new messages arriving on the queue. Currently only 100 messages will be in queue without collapsing. Delay_while_idle: The device is receiving messages if that’s not set as true. If we set as true for that then message will be arrive at the time device awake. The default timeout for messages are 4 weeks unless the time_to_live flage is set as true. Throttling: To prevent misuse or flood of messages to deliver a device and to optimize the battery life of android device GCM use throttling that’s token bucket scheme. Each application have granted their own collapse key even if it a single message. If collapse key exhaust then cloud server sends a new token and the messages are queued until the new token is created. What happens when uninstall the application: GCM server gets message from third party server. The GCM server send message to device. The application receives messages from GCM server and queries package manager whether they are have broadcast to configured and receive message Then client application informed to the GCM server the app is uninstalled. The GCM server marks the registration id for deletion. Then GCM server gets message from third party server The GCM return not registered and gives error message to the third party server. Then third party deletes the registration ID. By Baburaj Annamalai