How to enable “Fast App Resume” in your WP8 app?


If you are part of DVLUP program of Nokia, you might have noticed that, all Windows Phone 8 challenges have the same requirement “Employ Fast App Switching”. This is more likely same as “Fast App Resume”. So, what is this and how can you configure your app to support fast app resume?

 

In this small post for WPDev, we will discuss a bit about it and the simple process to configure your WP8 apps and/or games to process “Fast App Resume”.


What is “Fast App Switching”?

In Windows Phone 8, when the user navigates away from an application, the app goes into suspended state and the state preserves in memory by the operating system. If the user returns back to the app by pressing the hardware “back” button or by using the Task Switcher, the app instance resumes immediately. The app quickly resumes to the same state it was when the user navigated away because it was preserved in memory by the operating system. This process is called Fast App Switching or FAS.

 

Let’s assume, the user opens an app which loads the “MainPage.xaml” by default. Then the user navigates to another page named “SecondaryPage.xaml” and then he presses the Start button to do some other operations with his device. The app then goes to suspended state. Now he presses the back button or uses the task switcher to navigate back to the app. In this case, he will come back to the “SecondaryPage.xaml” where he was working before the app moved to suspended state.

 

What is “Fast App Resume”?

In Windows Phone 8, when the user navigates away from an application, the app goes into suspended state and the state preserves in memory by the operating system. If the user re-launches the app by tapping on the app’s primary tile from the Start Screen or the app name in the app list, the old instance of the app terminates by default and a new instance of the app generates. Windows Phone 8 introduces an ability for apps to request that user actions to re-launch the app to resume the suspended instance of the suspended if exists. This process is called Fast App Resume or FAR.

 

Let’s assume the user opens an app which loads the “MainPage.xaml” by default. Then the user navigates to another page named “SecondaryPage.xaml” and then presses the Start button to do some other operation with his device. The app goes to suspended state. But this time to come back again to the app, the user taps on the Start Screen tile or the app name in the app list instead of pressing the back button or the task switcher. Unlike to “Fast App Switching”, the app will not resume from the suspended state but will create a new instance to replace the previous one. Thus it goes thru the whole process of new app start and take time to load. Windows Phone 8 SDK provides a way to handle this and ask the app to resume from the suspended state which you needs to configure in your app to support Fast App Resume.

 

How to configure your WP8 to support “Fast App Resume”?

The process to enable “Fast App Resume” is very easy. If you want to enable Fast App Resume for your app, add the ActivationPolicy attribute to the DefaultTask element in the “WMAppManifest.xml” file by opening it in any XML file editor or notepad and set the value to “Resume” as shown below:

 

Fast App Resume configuration in app manifest file

 

That’s it! Now your Windows Phone 8 will support “Fast App Resume”. Now when the user taps the tile of the suspended app, it will just resume the app instead of creating a new instance.

 

I hope, this will give you a head start configuring your app/game to employ fast app switching and fast app resuming. Check out my other blog posts for more on Windows Phone and Windows 8 Store app development. Don’t forget to subscribe to my blog to get the regular article updates. I am also available on Twitter and Facebook. If you are using those, connect with me.


If you have come this far, it means that you liked what you are reading. Why not reach little more and connect with me directly on Twitter , Facebook , Google+ and LinkedIn . I would love to hear your thoughts and opinions on my articles directly. Also, don't forget to share your views and/or feedback in the comment section below.

7 comments

  1. Not so easy, there's also some work around stack navigation, see MSDN for the "'real" full story.

    ReplyDelete
  2. Really awesome post Kunal... I tried alot but this simple code block resolved my problem. Thanks

    ReplyDelete
    Replies
    1. Hi Nishant,

      Glad to hear that the post helped you implementing the "Fast App Resume" in your WP app.

      Delete
  3. Hi Kunal,

    I am new in WPD and facing some more issues. Please tell me did you ever work with XMPP?
    If yes then I want to keep my app in running state on background.

    Now, When I go to background my XMPP connection lost and will not be able to get any messages from anyone. For this I have to bring my app in foreground to reconnect again.

    Please help.

    Sorry, I have to write my problem over here because I didn't get any source to connect with you directly.
    Hope you understand.

    Thanks,
    Nishant

    ReplyDelete
    Replies
    1. Hi Nishant,

      If I understood your problem well, you will need a Push Notification from server. Check out some online tutorials which will help you to implement the same. Also, check for Background Services. You might need it here too.

      Regards,
      Kunal

      Delete


 
© 2008-2016 Kunal-Chowdhury.com - Microsoft Technology Blog for developers and consumers | Designed by Kunal Chowdhury
Back to top