Skip to content
September 19, 2011 / amsanjeev

An Introduction to C2DM


What is C2DM

C2DM stands for Cloud to Device Messaging. It  is a service provided by Google to allow Android developers to send data from third party servers to Android devices. The intention here is not to use it as a mechanism to share large amounts of data, but to share the occurrence of server events and some meta data to the Android device.

Need for C2DM

Currently most applications are modelled on client server architecture to restrict the use of system resources on the device side. Heavy use of system resources one the mobile device can ultimately affect the user experience which is an extremely important criteria in mobile devices.

The need to communicate server events to the client efficiently is required for most use cases . Prior to C2DM, the common approach for such a requirement has been to write a service that would poll the server regularly to check if there is any new event and execute applications logic accordingly . C2DM eliminates the need to have component running the client application by providing a mechanism by which the server can communicate asynchronously back to the client.

C2DM is not intended to be used as data channel between the server and the client. The recommended practice is to inform the device about the event at the server and so that the device can take appropriate client actions eg. sync data with the server. This avoids the need to write a service that keeps polling the server, ultimately reducing the system resource usage.

How it works

C2DM Workflow

C2DM Logical Workflow (Click to enlarge)

For detailed explaination, visit C2DM Workflow Explained

C2DM requirements

  1. Android 2.2 or above.
  2. App Server should have internet connectivity.
  3. Notification requirements are not beyond the available quotas.

Advantages of C2DM

  1. Better usage of system resources like device battery.
  2. Less stress on the servers compared to polling approach.
  3. No background process per application required on the device.

Limitations of C2DM

  1. Limited message size of 1024 bytes.
  2. Best effort delivery ( msg delivery not guaranteed
  3. No support for TTLS
  4. Requires server to have internet access.
  5. Quotas for day and hour.

Alternatives

Custom implementations of push notifications should be developed if you have one or more of the following limitations.

  1. App server with no internet connectivity.
  2. SLA requirements
  3. Require priority of messages
  4. Require guaranteed message delivery.
Apart from custom implementations some developer use SMS as a alternative. The downside of this approach is that it is not a free solution.

Information on how to build your custom push notification infrastructure is beyond the scope of this article and will be explained in detail in a different post.

Conclusion 

Applications with C2DM effectively integrated can leverage the Google infrastructure to provide the user with a better user experience. And the best part is that you do not have to pay to use this service unlike alternatives like SMS.

Hope all of you found this article informative.  In case you require more information please feel free to contact me .

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: