Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fast App Resume issues in windows phone 8

When i set ActivationPolicy="Resume" in WMAppManifest.xml page tile navigation(navigation URL) is not working in Tombstone state, it reloads the last back stack page(URL). It works fine with Dormant state with out reloading the page. If don't set this property (ActivationPolicy="Resume") it reloads the page in both states [Dormant state and Tombstone state].

But how can we achieve the navigation to secondary url's, when we set that property.

Please help me .

like image 319
Kathir Avatar asked Jan 16 '13 05:01

Kathir


2 Answers

Adding ActivationPolicy="Resume" is not the only step needed to have your app support Fast App Resume. I believe the behavior you are describing is normal when you only set that one property. I think there are a few ways to implement "Fast App Resume", but I found this to be the easiest way.

Set the activation policy like you just described and then do the following:

Go into App.xaml.cs in the "App" class add:

   private bool reset

You should then have a method for InitializePhoneApplication that initializes the RootFrame. Add this:

RootFrame.Navigating += RootFrame_Navigating;
RootFrame.Navigated += RootFrame_Navigated;

Then you can go and add those methods:

void RootFrame_Navigating(object sender, NavigatingCancelEventArgs e)
{
    if (reset && e.IsCancelable && e.Uri.OriginalString == "/MainPage.xaml")
    {
        e.Cancel = true;
        reset = false;
    }
}

void RootFrame_Navigated(object sender, NavigationEventArgs e)
{
    reset = e.NavigationMode == NavigationMode.Reset;
}

If you implement this properly, your app should resume from the last page you were on.

like image 52
HarryM Avatar answered Nov 23 '22 03:11

HarryM


Same problem here. I got WP8 application with Fast App Resume enabled. I can pin tiles pointing to specific pages in my apps. It works fine when app is just Suspended, but when the app is Tombstoned, then clicking secondary tile has the same effect as clicking the main tile.

I receive only one RootFrameNavigating event with NavigationMode == Back and Uri == /MainPage.xaml. The app then shows the previous page that was there before I suspended the app.

I guess this is actual bug in the platform for this specific scenario - Fast App Resume + tombstoned app + navigation from pinned tile, that we as developers cannot solve.

like image 45
Martin Suchan Avatar answered Nov 23 '22 03:11

Martin Suchan