One of the issues of using CLOUD is not of polling info – this we know to do using SOAP or REST on top of web servers etc.
But how do we know that we need to get data? One alternative is by polling on the Web service all the time asking if something changed. This is bad for few reasons:
- Usage of battery.
- Usage of bandwidth.
- Server resources (CPU, RAM)
Android provide us with a unique mechanism – C2DM! This is defined by google as:
Android Cloud to Device Messaging (C2DM) is a service that helps developers send data from servers to their applications on Android devices. The service provides a simple, lightweight mechanism that servers can use to tell mobile applications to contact the server directly, to fetch updated application or user data. The C2DM service handles all aspects of queueing of messages and delivery to the target application running on the target device.
You can find short explanation over here:
This is also deprecated so now google recoomend GCM which is:
Google Cloud Messaging for Android (GCM) is a service that helps developers send data from servers to their Android applications on Android devices. This could be a lightweight message telling the Android application that there is new data to be fetched from the server (for instance, a movie uploaded by a friend), or it could be a message containing up to 4kb of payload data (so apps like instant messaging can consume the message directly). The GCM service handles all aspects of queueing of messages and delivery to the target Android application running on the target device.
And here is a simple tutorial: