Windows Phone Fast Application Switching–Don’t Panic!

Windows Phone Tutorial

With Mango, the Windows Phone application life cycle changes, and that is a good thing, tombstone_istock because the change allows for Fast Application Switching (FAS).  With FAS, the user can start a new application and then return to your application without seeing the “resuming…” screen and without a discernable pause.

Getting ready for FAS is the most important step you can take, because FAS will make your application more responsive. But you only get this extra responsiveness if you test whether you are returning from the Dormant vs. the Tombstoned state.

Most of the time you’ll be returning from the Dormant state, so this is well worth doing.

You only need to do this test if your code restores application state  in response to the  Application_Activated event. In that case, be sure to add a test to see if you are returning from Dormant (rather than from Tombstoned) by testing the IsApplicationInstancePreserved flag,

private void Application_Activated(
   object sender, ActivatedEventArgs e)
  if ( e.IsApplicationInstancePreserved )
      // do not restore application state
     // restore application state

If you are returning from Dormant state,  the IsApplicationInstancePreserved flag will be true, and you do not have to and do not want to restore state; your state is intact.  Not restoring state under these conditions will make your application much more responsive when the user switches away and then switches back.

About Jesse Liberty

Jesse Liberty has three decades of experience writing and delivering software projects and is the author of 2 dozen books and a couple dozen Pluralsight & LinkedIn Learning courses. He was a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a Xamarin Certified Mobile Developer and a Xamarin MVP and a Microsoft MVP.
This entry was posted in Essentials, Mango, Mini-Tutorial, WindowsPhone and tagged . Bookmark the permalink.

3 Responses to Windows Phone Fast Application Switching–Don’t Panic!

  1. Pingback: Windows Phone Fast Application Switching–Don’t Panic! –

Comments are closed.