June 6, 2010

Multitasking on Mobile devices - Android style

Enabling multitasking for third party mobile applications can be a tricky proposition in the best of times. Rogue applications hogging memory and draining the battery are most cited concerns - this is common knowledge. It is in this context that Android's philosophy on multitasking is a refreshing change. Tim Bray has a great overview on Android's multitasking functionality in his Android Developers blog post. "All applications are created equal" and "All applications run all the time" are the tenets on which the system has been designed and designed elegantly at that. Contrast this with once popular co-operative multitasking systems that depend on user applications explicitly ceding control failing which the device may become unresponsive and you will be able to appreciate the philosophy of Android better.

But the real deal on Android is not multitasking on its own, it is the overall way in which UI components, applications and background components gel together to create a fabulous user experience. Consider an example: Go to the gallery, select a picture to be uploaded to facebook. What the user sees is a Toast prompt saying something on the lines that the picture would be uploaded, further suggesting the user to look at the notification bar for the progress of the upload operation. The user can, in the meantime, select another image for upload and Android obliges. What the user doesn't see is a upload progress bar blocking further uploads. Instead the nifty notification bar/window takes over that mantle. A background service performs the upload operation and updates the notification window leaving the main application window open for further user interaction.

What if the user chooses to switch the application after choosing to upload the picture? I know that app developers want users to stay on their application longer and may not be comfortable with the user "exiting" their application even though the operation is not fully completed. Worst still what if the operation fails? The notification window solves this problem as well. Whether the user gets an intimation that the operation has failed (say via a Toast) or the user voluntarily checks back in the notification window, clicking on the appropriate notification will lead the user back to the application. Developers even have the freedom to create a custom layout for the notification space. For example, the notification window can contain the application's icon, action buttons or progress bars. A good starting point for exploring this functionality is RemoteService.java present in ApiDemos.

As explained above, Android spins an excellent mobile experience built around a unique philosophy on multitasking. It is not multitasking itself that makes a difference, it is how applications use the power of multitasking, not just for providing the user with advanced functionality, but offering him a hassle free experience that counts.

Until next time, cheers!