Application Deactivation and Tombstoning

Must Read

Playing with Windows Phone Touch and Sensors

Creating your first touch application/game For Windows Phone 7, touchscreen is the most convenient way of allowing the user to...

Flash Builder ViewNavigator

Flash Builder and its Hero APIs provide functionality to handle view management. Create a new project under File→New→Flex Mobile project....

Bad Credit Private Student Loans – Why Do You Need Private Student Loan Consolidation?

Non profit enterprises and private financial organizations are the federal institutions that offer loans to students. The offered amount...

Place Strategy

Moving a food from manufacturers to consumer is sometimes a costly task. It is critical that the proper channels...

Advantages and disadvantages of the PC operating system

Operating System (OS for short) is responsible for coordinating the management and sharing of computer resources. No operating system...

Providing Hints with Placeholder Text

Placeholder text provides users with instructions on how they should fill in the fields. A sign-up form with placeholder...

Unlike a traditional operating system on a desktop or server computer, Windows Phone 7 does not run multiple applications concurrently. Only one application—the foreground application—can be active and running at any one time. When the user switches away from the foreground application, or when an external event causes another application to become the foreground application, the original application is deactivated in a process referred to as “tombstoning.” When the user switches back to the application, it is reactivated.

This means that if you want to preserve state (including page and control state) when your application stops being the foreground application, you must handle the events exposed by the operating system to save any state you require to implement a seamless resume experience (such as setting the contents of text boxes, a selected date, and so on). This saved state will be used to restore the application and page state when the application reactivates.

External events that may cause the application to be tombstoned include events such as a phone call being received; a system dialog box, such as the built-in photo selector, being displayed; or the phone lock screen being activated.

In addition, an application that is tombstoned may be completely removed from memory if, for example, the operating system detects that the device is running low on resources. In this scenario, when the user goes back to the application, it will restart. Therefore, you must make sure that you have preserved all persistent state to storage whenever your application is deactivated.

You handle the Launching event to retrieve state for your application from isolated storage on the device and/or from a remote service, as appropriate, when the user first starts your application from the phone’s Start screen. You also handle the Closing event that occurs when the user closes your application (or presses the Back button to navigate backward through the pages of the application past the application’s first page) to save any state your application requires to isolated storage on the device and/or to a remote service, as appropriate.

You must also handle the Deactivated and Activated events. The Deactivated event occurs before the application is tombstoned, and you should save any transient state to the phone application service so that it can be quickly reinstated when the application is resumed. The operating system provides two objects where you save that transient state. Save transient application data to the PhoneApplication Service.State property, and save transient page state to the PhoneApplicationPage.State property. There is a time limit for the Deactivated event to complete. The device may terminate the application if it takes longer than 10 seconds to save the transient state.

Note: There is no guarantee that an application that was deactivated will be reactivated, so, in addition to the transient state, you should also save any persistent state to isolated storage or a remote service, as appropriate. Applications that require a large volume of persisted data may need to save that data incrementally while the application is running to ensure timely deactivation.

The Activated event occurs when the user navigates back to your application using the Back button, or when a launcher or chooser that has interrupted execution to handle a phone call or to display the lock screen is deactivated. When your application is reactivated, you should retrieve the transient data from the PhoneApplication Service.State and PhoneApplicationPage.State property bags in the Activated event. As with the Deactivated event, there is a time limit
for the Activated event to complete. The device may terminate the application if it takes longer than 10 seconds to reload the transient state and return the application to a running state.

Note: Launchers and choosers allow other applications or operating system features to execute while your application is running. For example, the PhoneCallTask launcher activates when a phone call is received, or your application may use a launcher, such as the PhotoChooserTask, to select a photo from the device storage. For more information, see “Launchers and Choosers for Windows Phone” on MSDN (

Figure 2 shows the life cycle, execution flow, and events you must handle to preserve state in a Windows Phone 7 application.

The life cycle and events

For a full explanation of the ways that you should handle the life cycle events in your application, see “Application Lifecycle” on Channel 9 ( and “Execution Model for Windows Phone” on MSDN (
en-us/library/ff769557(VS.92).aspx). A useful resource that explains how to use the PhoneApplicationService class is “How to: Preserve and Restore Page State for Windows Phone” on MSDN (



Latest News

Digital Marketing for Beginners

Digital marketing for starter, Let to basic learning about connecting with your audience in the right place at the...

What are 7 things poor people do that the rich don’t?

1. poor people watch TV in which people read books how many hours you spend in front of the TV and when was the...

Top 18 best small business ideas for beginners starting

A small business can be frightening and requires plenty of careful planning there are many small business ideas which can be beneficial as well...

Summer that makes you happy

We saw were already here I've been thinking about some of the things. I used to do with my husband even though he had...

4 Point to helpful tips specifically for caregivers

What you need to take a vacation. I know it sounds impossible creative and try to make it work for you almost everyone needs...

More Articles Like This