Search code examples
c#windows-runtimewindows-phone-8.1windows-phone

Register app for a URI association (Windows Phone 8.1 RT)


Hello i want to create a scheme URI to launch my app from another app. I searched a lot, i found this tutorial URI associations, it shows how to register your app for A URI association but it is for Windows Phone 8. I am developing an app for Windows Phone 8.1 RT and none of the tutorials i found work. At least I'd like to know if it is supported on WP 8.1 RT.


Solution

  • The term you're looking for is protocol activation. You can have a look at the official Association launching sample.

    In short: you configure your protocol in your appxmanifest and handle activation in you App.xaml.cs code behind.

    protected override void OnActivated(IActivatedEventArgs args)
    {
        if (args.Kind == ActivationKind.Protocol)
        {
            ProtocolActivatedEventArgs protocolArgs =
               args as ProtocolActivatedEventArgs;
            var rootFrame = new Frame();
            rootFrame.Navigate(typeof(BlogItems), args);
            Window.Current.Content = rootFrame;
        }
        Window.Current.Activate();
    }