What is Fast Application Switching (FAS)?
Imagine application “A” is running and user launches a new application “B”. On pressing hardware back button user can return back to application “A”. If application “A” gets activated without “resuming “ screen then it can be termed as “ Fast Application Switching “
What is dormant state?
In Windows Phone 7.5 version FAS is improved over Windows Phone 7 with introduction of new state in application life cycle called “Dormant state”. Whereas in Windows Phone 7.0 version there was no Dormant state and on deactivation application directly goes to Tombstone state.
With introduction of dormant state in application life cycle, operating system preserve instance of the application in memory unless it is forced to release due to low memory. So at the time of application reactivation as a developer you need to check whether to restore the application or not? If application is reactivating from dormant state then there should not be restoration.
Checking Application returning from Dormant state
On Application Activated event you can check whether application is reactivating from dormant or tombstone state as below,
private void Application_Activated(object sender, ActivatedEventArgs e) { if (e.IsApplicationInstancePreserved) { // No need to restore the application. // Application is reactivating from dormant state } else { // Need to restore the application. // Application is reactivating from tombstone state // Read state dictionary and Navigation state to restore memory state } }
In this way you can check whether application is returning from dormant state. I hope this post is useful. Thanks for reading.
Follow @debug_mode
Leave a Reply