Select a language to translate this page!
Powered by Microsoft® Translator
This blog post was authored by Matt Hidinger (@matthidinger), a Program Manager on the Windows Phone team.
Windows Phone offers developers an important choice in how their app resumes from Start. By default, each time a user launches an app from Start or from the App list, a completely new instance of the app is created. This is true even if the user was just using the app and viewing a different page. This default experience works great for apps that follow the "hub and spoke" navigation pattern; that is, apps that have a centralized hub and a shallow navigation hierarchy. All the first-party apps follow this model; the app's home page is never more than 2-3 presses of the Back button away.
Not every app fits perfectly with this "fresh start" experience, so in Windows Phone 8 we added support for Fast App Resume.
Fast App Resume offers two benefits:
I'm glad you asked. Act now, and you too can have Fast App Resume for the low, low cost of one XML attribute!
Naturally, if someone says “just change this one XML file and all your problems will go away” your developer senses may suspect a hint of snake oil!
So read on, and you’ll get all the information you need to create a great app resume experience for your user.
The most challenging part of enabling Fast App Resume is determining the best user experience for various scenarios. Here are a few questions you should run through to help you decide which option to use.
First and foremost, when the user launches my app, should I resume where they left off, or always take them to the app's home page?
Many apps today use this model to implement Fast App Resume. To see it in action, check out the latest versions of Twitter, Yelp, or ESPN ScoreCenter.
Some important things to consider are:
That works too! If you do use Fast App Resume, you'll get a performance win on app start. To the app user, nothing has changed: they always launch the app to the home page, but by reusing the same app instance your app will launch faster.
To provide this experience, you simply remove all pages on the back stack when the app resumes, before the user is presented with the app home page.
To try this out, open the sample project attached to this post and set the _mustClearPagestack field to true, as follows:
Fast App Resume can be a little tricky at first. The best way to get a handle is to download the sample project and see how it works on a device. Adjust a few settings, watch the navigation flow, observe when to reset the back stack, etc.
When you've got the project loaded in Visual Studio, all the Fast App Resume logic is centralized in App.xaml.cs, line 168, in the Phone And FAR Initialization region. As I said, it's a little tricky to follow, because the code in this region requires changing or cancelling navigation events, checking a few state enums, and occasionally manipulating the back stack. But dropping this region of code into your App.xaml.cs should get you well on your way to offering a great Fast App Resume experience!
For a more detailed explanation of the App.xaml.cs code modifications required, be sure to check out another Fast App Resume sample that my sample project is based on.
To download and learn about additional Fast App Resume scenarios, see How to take full advantage of Fast App Resume in your Windows Phone 8 app. For more insight on Fast App Resume, see the MSDN page on Fast App Resume.