Multitasking for Windows Phone
March 23, 2012
To help ensure a fast and responsive user experience and to optimize power consumption on the device, Windows Phone allows only one application to run in the foreground at a time. In Windows Phone 7.5, several features are introduced that allow an application to perform actions even when it is not the active foreground application.
Windows Phone applications can play audio that continues even when your application is no longer running in the foreground. To accomplish this, you must create an AudioPlayerAgent that continues to run in the background. For more information, see How to: Play Background Audio for Windows Phone.
Scheduled tasks allow an application to implement an agent that can execute code in the background even when the main application is not running. There are two ways one of these agents can be scheduled. A Periodic Task runs regularly for a short amount of time. A resource-intensive task runs for a longer period of time, but only when the device is in a state where resource-intensive processing will not disrupt the foreground experience. For more information, see Background Agents Overview for Windows Phone.
The background transfer service allows an application to queue up multiple HTTP file transfer requests that will continue to be performed when the application is no longer running in the foreground. Both file download and upload are supported. For more information, see Background File Transfers Overview for Windows Phone.
Scheduled Notifications allow applications to register recurring and one-time alarms and reminders that pop up in the foreground on a predefined schedule. The user experience is similar to the reminders implemented by the built-in calendar application. A user tapping an alarm or reminder launches your application. For more information, see Alarms and Reminders for Windows Phone.
In previous versions of Windows Phone, an application was automatically terminated when the user navigated away from it. In Windows Phone 7.5, applications are typically put into a dormant state when the user navigates away. In this state, the application is preserved in memory so that if the user returns to the application, it can resume almost instantly. Applications don’t need to implement any code to enable fast application switching; it is enabled automatically. However, it is still possible that an application will be terminated while it is dormant. It is important that you design your application so that it handles these changes in state that occur throughout the application lifecycle. For more information, see Execution Model for Windows Phone.
Note:
|
|---|
|
|
Note:
Fast Application Switching is supported on 256-MB devices. However, because keeping applications in a dormant state for Fast Application Switching is dependent on the phone’s available memory, an application running on 256-MB devices will be terminated and tombstoned more often and more quickly than the same application running on a phone with more memory. For information on properly handling application termination and tombstoning, see