“Push” and “pull” are rather mainstream concepts in business strategy, but do you know how it applies to mobile applications? There are three kinds of applications that provide access to data in the cloud: mobile alerts
, send-to-phone apps (sends a map, a web page, etc) and background sync apps (that synchronize your devices). In order to deliver fresh content, mobile applications can use two techniques to get updates from the cloud: push and pull.
Google explained at Google I/O why developers have to use push updates, and announced the launch of an API for push applications for Android.
Take a news update application as an example of the utility of this feature. Either the application regularly connects to the server in the cloud and checks for fresh headlines (pull), or the server itself sends an alert to your application each time there is a new headline (push). In other words, pull is when the application connects to the server to update content, and push is when the server wakes the application up whenever there is an update.
Most mobile applications are pull applications. Pull notification is easy to implement but the downside is that it uses a considerable amount of battery, since it always runs in the background. So Google decided to work on a very promising API called Android Cloud to Device Messaging, devoted to help developers build efficient push applications.
Basically, the Android Cloud to Device Messaging API allows servers to tell the application when new data is available. This way, the mobile app does not have to run in the background. Google’s server notifies the app when new data is available, which saves battery. The API has several interesting options, like the While Idle option, which allows Google to recognize if the Android device's screen is on or off. If the developer activates the “While Idle” option, it gives them the possibility to store fresh data on the server while the screen is off, and to update content once the user turns the screen on again.
Google announced that the API would be open to all developers, offering them new tools to build more complex applications for Android 2.2 devices and improve the trade-off between efficiency (saving battery) and data refreshing.