When the Windows Phone is deactivated, the application enters the dormant state. Some of the scenario when the application can go to the dormant state are
- User uses the start button to navigate to different application.
- User receives a call when using the application
- User launches the launcher or chooser. etc.
How to Detect the App if returning from Dormant or Tombstoned State in Windows Phone 8?
It may be necessary to restore the transient data of the app when the app is started after it is Tombstoned but may not be necessary during the dormant state.
This can be handled in the Application Activated Event and use the parameter IsApplicationInstancePreserved of the ActivatedEventArgs. If the IsApplicationInstancePreserved is false, the transient state data might needs to be restored.
// Code to execute when the application is activated (brought to foreground) // This code will not execute when the application is first launched private void Application_Activated(object sender, ActivatedEventArgs e) { if (e.IsApplicationInstancePreserved) { //Dormant State } else { // } }
Leave a Reply