How to Detect the App returning from Dormant or Tombstoned State in Windows Phone 8?

Published on July 27, 2013 by abundantcode

Filed under Windows Phone

Last modified July 27, 2013

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 3908 times

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

{

//

}

}
0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Comment


x

You might be Interested in these Posts

How to delete user account from command line in Windows 10 ?

You can delete a user account from command line in Windows 10 using the net user command and specify...

How to add new user account from command line in Windows 10 ?

You can add a new user account in Windows 10 using command prompt using the net user command and pas...

How to open display settings from command line in Windows 10 ?

The display properties can be found in the settings app in Windows 10 which lets the users to config...