Fast App Resume issues in windows phone 8

后端 未结 2 489
耶瑟儿~
耶瑟儿~ 2021-02-06 09:44

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

相关标签:
2条回答
  • 2021-02-06 10:00

    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.

    0 讨论(0)
  • 2021-02-06 10:00

    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.

    0 讨论(0)
提交回复
热议问题