While Windows Phone platform brought a new and much improved mobile operating system from Microsoft, the first version did not have the platform maturity its rivals enjoyed at the moment. However with Windows Phone Mango, also called the 7.5 version of the Windows Phone operating system, Microsoft brought in about 500 changes from the 7.0 release, the primary being the multitasking, which brought with it parity with its rivals.
For performance optimization, Windows Phone runs only one process in the foreground (unlike our desktops which can run quite a few). To ensure that user experience is optimal, Windows Phone Mango now has the ability to run an application in the background (so display resources are only utilized for the process running in the foreground).
You no longer are constrained to keeping your Music player application running while you desperately want to check your Facebook Wall or the latest YouTube trending video. An application developer can create an AudioPlayerAgent, which can run in the background rendering your favorite tunes while you check your email /Facebook posts.
multitasking in the Windows Phone platform enables scheduled tasks. This feature allows applications to run code in the background when the main application is not running. Check out the Background Agents article for more details on this.
Background File Transfers
You no longer have to wait for an active download in your application to move on to the next important thing on your phone. Windows Phone Mango allows applications to use the background transfer service to queue downloads, which can be performed when the application is not running in the foreground. At the time of writing this article, both uploading and downloading files in the background are supported.
The APIs reside in the Microsoft.Phone.BackgroundTransfer class.
This is akin to the alarm clock facility, however, this feature is meant for an application to set up reminders to launch itself. The reminders can be one-time or recurring. You can use the ScheduledNotification class to do this.
Faster Application Switching
With Windows Phone 7.0, any action that navigated a user away from the application would result in termination of the application. With Windows Phone 7.5, this behavior has changed for the better. Upon navigating away, an application is put into a dormant state. When the user navigates back to the application, it restores its state and hence it can resume instantly without any performance delays. This feature is on by default, so applications do not have to write even a single line of code to support this.
While discussing the new possibilities unleashed by multitasking, we should not forget that primary drives, which enables this behavior. Due to the limited resources available on these mobile devices, the operating system will try to swap resources from an idle application and give them to an in-use application. While developers in general dislike this feature, they have to account for this Windows Phone operating system behavior in their application invocation scenarios and architect their application accordingly. An application can be tombstoned away and resurrected back. Tombstoning also follows a Deactivated event, although a deactivated application isn't guaranteed to be tombstoned.
An application enters the Deactivated/Tombstoned stage usually when the user presses the Start button, or the lock screen comes up, or a user clicks a popped-up toast of another application and navigates to it.
In all such cases, the application needs to handle the state transition accurately to allow the application user a pleasant experience.
In this article, we learned about the new features that are enabled on the Windows Phone platform by the introduction of multitasking in Mango.