Wednesday, August 01, 2012

Google Cloud Messaging with Android

You might have heard of C2DM (Cloud-to-Device Messaging), which basically allowed third-party applications to send (push) lightweight messages to their Android applications. Well, C2DM as such is now deprecated and replaced with its successor up the evolutionary ladder: GCM, or Google Cloud Messaging.

GCM is a (free) service that allows developers to push 2 types of messages from their application servers to any number of Android devices registered with the service:

  1. Collapsible, "send-to-sync" messages
  2. Non-collapsible messages with a payload up to 4K in size
"Collapsible" means that the most recent message overwrites the previous one.  A "send-to-sync" message is used to notify a mobile application to sync its data with the server. In case the device comes online after being offline for a while, the client will only get the most recent server message.

If you want to add push notifications to your Android applications, the Getting Started guide will walk you through the set up process step by step, even supplying you with a two-part Demo Application (client + server) that you can just install and play around with. The set-up process will provide you with the two most essential pieces of information needed to run GCM:

  1. An API key, needed by your server to send GCM push notifications
  2. A Sender ID, needed by your clients to receive GCM messages from the server
All summarized in the following screen you get after using the Google API console:

Inline image 2

Read more: DZone
QR: Inline image 1

Posted via email from Jasper-Net