Android 2.2 Froyo - Cloud to Device Messaging

Last Updated on Thursday, 06 October 2011 21:05

In Android 2.2 (Froyo), many exciting new features have been announced and one of these services is the Android Cloud to Device Messaging. The Android Cloud to Device Messaging (C2DM) is a service that helps developers sends data from servers to their applications on Android devices.

So how will C2DM helps?

Most of the useful and fun applications on our mobile phones make use of Internet connectivity to keep users connected and to refresh applications’ data. One of the ways that applications normally use to update their data is via polling. POP mail clients, for example, connect to the server every 15 minutes or so to grab fresh data. Polling is fairly easy to implement, and works well in many situations. What is hard to determine though is the frequency of the polling. Poll too often, you may not see any new data, and consumes precious bandwidth and battery life. Poll too rarely and the data on the device may become stale.

Having the server push messages to the client as and when it is needed may be a better choice for refreshing of data in applications. This will result in more efficient use of the network and the mobile phone’s battery. However, it’s also tricky to implement a good push solution, and it isn’t free as there is some overhead in maintaining the required connection. Moreover, on a mobile device such as an Android phone, implementing applications to receive these messages is difficult. There might be issues with patchy network coverage and zombie connections created when the wireless carrier’s routers time out connections that idle for too long.

Now, within Android itself, it has a daemon that maintains persistent background communication with Google's servers. The always-on connection is used to facilitate some of the push synchronization capabilities that Google offers for its own applications, such as Gmail, Contacts and Calendar. So, what Google has done is that starting with Android 2.2, Google will open this service up and allow third-party developers to make use of the same service that Google apps used for updating. That, in essence, is the C2DM framework.

To illustrate the flow of messages from the Google “Cloud” to your device and vice versa, here is the relevant information from the presentation by Debajit Ghosh during the recent Google I/O.

Overview of Lifecycle

1) Enabling cloud to device messaging

- App (on device) registers with Google, gets registration ID

- App sends registration ID to its App Server

2) Per message

- App Server sends (authenticated) message to Google

- Google sends message to device

3) Disabling cloud to device messaging

- App can unregister ID, e.g., when user no longer wants push



To demonstrate just how flexible and useful C2DM can be, let’s take a look at the Chrome to Android extension that makes use of C2DM to deliver information to your Android phone. Now, as with all new technology, I wonder whether this will have any future security implications. The ability to push content or a set of instructions down to your Android phone to activate its applications seem to be a functionality that is just asking to be exploited? Nonetheless, this is an exciting update that has been made possible by Google and I am hoping for the next great app to be introduced as a result of this.

Enjoy!

Banner
E-mail
Print
PDF
 

Add comment


Security code
Refresh

Banner
RSS
Subscribe Now
Newsletters
Newsletter Archive
Facebook
Become a Fan
Twitter
Follow Us
Sign up for AndroidMeUp Newsletter