Distinguish between page navigation and fast app switch on WP8

211 views Asked by At

To dispose and re-create resources, I have to distinguish between navigation to another page of the application and a fast app switch.

How could I accomplish this? Which events do I have to use to do this task correctly?

The application is a XAML with DirectX app running on Windows Phone 8.

With best regards, Emi

1

There are 1 answers

0
Paul Annetts On BEST ANSWER

You can register for OnNavigated events in the application frame (PhoneApplicationFrame or any custom frame you use), or override the OnNavigatedFrom method of your page.

Then you can query the NavigationEventArgs to check if the URI is an external page. For example:

    private void OnNavigated(object sender, NavigationEventArgs navigationEventArgs)
    {
        if (navigationEventArgs.Uri.ToString() == "app://external/")
        {
            // This is a Fast App Switch navigation

        }
    }