Wednesday, July 20, 2011

Cloud To Device Messaging

C2DM -  Cloud To Device Messaging.



    what is the Requirment?
  • We want to keep the data on the device fresh.

    What is Cloud to Device Messaging?
  • To push infromation from intrenet to android phone.This is called C2DM.

    When was it Intrduced?
  • From Android2.2 or API 8

    Why was this introduced?
  • The standard mechanism of application which requiers information from internet requires to poll periodically. which involves consumtion unnessary usage of bandwidth and battary use.

    How it works?
  • To use C2DM on your Android device you have to write an Android application.
  • This application should be registered with Google server to able to recive push messages from Google server.
  • Your server registers with the Google server and authenticates himself. Then your server can push messages to Google Server in turn push messages to the infromation to the devices.
  • For this authentication you reqire a Google user.

    what are the device Requirments?
  • C2DM only works only on Android2.2
  • Requires Android Market application is installed on the device.
  • To use C2DM on the Android emultor you also need to use a google device with API 8 or higher (Android 2.2 or above) and to register with a Google account on the emulator via the settings.
    What are C2DM Limitations?
  • Still in Labs
  • Message payload limited to 1024 bytes
  • Message be get last or be delivered out of order
  • No Support for TTL's - i cannot say that message expires if the devices is not avaiable in 2min .. but it will develiver the messages even the message is outdated
  • Quota limits are not clear

    How does the Information Flow?
  • In a C2DM you have three parties involved.
            1. The server which wants to push messages to the Android Device - Application server
            2. Google C2DM Server
            3. Android Application

  • To enable C2DM for an Android application, your application must register with the Google C2DM servers. After registration it receives a registration ID from Google C2DM Servers.
  • The Android Applicatoin must then send the registration ID to its application server.
  • When the application server needs to push a message to the Android application, it sends the message via HTTP GET to Google C2DM servers.
  • The C2DM servers route the message to the device once the device is available, and an intent broadcast is sent to the Android application.

    How the registration process takes place?
  • To register your application for the C2DM service your application needs fire an registration intent "com.google.android.c2dm.intent.REGISTER" to C2DM server.
    This intent includes a Google mail address and the application ID.
  • Upon successful registration the C2DM server broadcast a REGISTRATION intent to the application which includes a registration ID. Each registration ID represents
          a particular device, e.g. every Android phone will recive its own registration code.

No comments:

Post a Comment