Android C2DM:
Cloud to Device Messaging is the latest technique (introduced in Android 2.2) that people are starting to use in their applications to have the real time or latest information. It has advantages not just like reducing the load on the application by preventing it from periodically polling the server but also from a mobile device point of view i.e, reduce the battery suck-up which is very important for an application. Anyway, you might have gone through various tutorials on how to set up C2DM in the application etc and so, I don't see a point putting them down here. But I can still give the highest level explanation.
The point of this post is to clarify (if anyone required any) about a misconception while handling C2DM's minimum API level requirement. Always check the API level running in the device but not the minSdkVersion mentioned in AndroidManifest.xml and then handle take decision whether to add C2DM in the application or not. That is, if the API level running in the device is >= Build.VERSION_CODES.FROYO, then only enable C2DM, otherwise don't.
Please comment if there are any corrections or you have any queries about C2DM.
Cloud to Device Messaging is the latest technique (introduced in Android 2.2) that people are starting to use in their applications to have the real time or latest information. It has advantages not just like reducing the load on the application by preventing it from periodically polling the server but also from a mobile device point of view i.e, reduce the battery suck-up which is very important for an application. Anyway, you might have gone through various tutorials on how to set up C2DM in the application etc and so, I don't see a point putting them down here. But I can still give the highest level explanation.
- App from device A wants to send a message M to the app in device B.
- A sends the message M to application server.
- Application server sends another tiny message m to C2DM server (nothing but a google server) giving the destination details (by giving registration id of B)
- C2DM server in turn sends the message m to B (message reaches specific application in that specific device). Android wakes up the corresponding application.
- Application must know how to handle the message. Basically it should create a Status Bar Notification (SBN).
- When user taps on the SBN, the application will connect to the server and get the actual message M.
The point of this post is to clarify (if anyone required any) about a misconception while handling C2DM's minimum API level requirement. Always check the API level running in the device but not the minSdkVersion mentioned in AndroidManifest.xml and then handle take decision whether to add C2DM in the application or not. That is, if the API level running in the device is >= Build.VERSION_CODES.FROYO, then only enable C2DM, otherwise don't.
Please comment if there are any corrections or you have any queries about C2DM.
No comments:
Post a Comment