Windows Phone Multitasking–Fast Application Switching

June 30, 2011 — Leave a comment

I recently wrote about the updated story on Windows Phone and Multitasking.  Yes, Windows Phone does multitask and gives developers a few options to get things done which are

  1. Background Audio
  2. Background File Transfers
  3. Fast Application Switching
  4. Scheduled Notifications
  5. Scheduled Tasks

I have already covered Scheduled Notifications on Windows Phone.  In this article, I’ll cover Fast Application Switching or FAS. FAS essentially allows a user to quickly switch applications and not see a delay in switching apps or the ‘resuming …’ screen. When a user navigates away from your application, it will be put in a ‘dormant’ state but the application will still be held in memory. Be aware that even though you are in a dormant state, your threads, timers, web connections will stop running so essentially you can’t run any background threads while dormant.  This image gives a good visual indication of what is happening

image

 

Now, the great thing is you really don’t have to do anything to implement this, as it’s automatically there if you are compiling for Mango.  If your application is compiled for Windows Phone RTM or Nodo and is in Marketplace, you will have to re-compile to get Fast Application Switching.  ‘Legacy’ apps will not get the ‘dormant’ state and will go straight to tombstoned as seen in this image

image

With FAS, as a develoepr you have to be aware that you may still get tombstoned if the device is running low on memory and the OS will tombstone the oldest app. When coming back into the Activated state, you might want to know if you have been tombstoned or not.  This is pretty easy to find out using the ActivatedEventArgs.IsApplicaitonInstancePreserved as follows

As usual not overly complex, and that’s a good thing!  If you want more details on getting ready for Fast Application Switching make sure you spend the time to watch the MIX11 session.  If you are still unsure or unfamiliar with Tombstoning, read over the Execution Model Overview for Windows Phone on MSDN and play around with Visual Studio writing code.

Make sure you are prepared for this, as it will make a far better user experience for your app than the ‘resuming …’ screen!

No Comments

Be the first to start the conversation.

Leave a Reply