Lifecycle of a Windows Phone 7 App

The model for for the entire lifetime of  an application, ie from the launch to the termination is called the Windows Phone Execution Model. Each Application moves through the stages of the life cycle.  The events are 
1) Launch/Start
2) Running
3) Pause/Deactivation
5) Close
Launch State
A Windows Phone Application is considered to be in a Launch state when it is initiated by a user, either from the list of installed applications or from the tile for the application in Start. When the application is started a Launch event is raised and it’s here we creates a new instance for the app. This event is raised before the application is visible or active. So loading data from isolated storage or performing time consuming tasks are highly discouraged coz it will increase the startup time of the app there by providing a bad user experience. 
Running State
Once the app is loaded, then it will be in the running state. In this state, the app keep tracks of its state as the user goes back and forth through the application pages. 
Paused State.
This is an interesting state in the lifecycle of an app.  The app enters Deactivated state when it is interrupted by an incoming call or other tasks such as taking a photo or sending an email or even starting another app. Any of these interrupts will cause the Deactivated event to fire. When an app is deactivated the OS will keep a record of the application and stores the state to the isolated storage. MS guys calls this process as TombStoning. 
Reactivated State.
When the user comes back to a deactivated or tombstoned app, the application is restored to the point where the user has left the app. There are chances that an user may or may not return to a tombstoned app. This can lead to drainage of the memory and storage space. Inorder to avoid this OS keeps track of long running tombstoned apps and terminates it appropriately so that the phone doesn’t run out on memory and storage.

Leave a Reply

Your email address will not be published. Required fields are marked *