Custom URL Scheme for Windows 8

Is there something like this for the Windows 8 platform for a custom url scheme found on the iOS platform?

I found information on MSDN about the application URI scheme. This is not an answer.

In my iPad app, the user receives an email with multiple long keys. The user clicks the url and my app opens to the correct page with these values. Is there a similar functionality for Windows 8 that I missed?

+3


source to share


2 answers


You are looking for protocol activation.

You can add a supported protocol to Package.appxmanifest

the tab Declarations

by adding Protocol

. This adds the following block to your file Package.appxmanifest

:

<Extensions>
  <Extension Category="windows.protocol">
    <Protocol Name="alrt" />
  </Extension>
</Extensions>

      



You need to handle protocol activation in App.xaml.cs

by overriding OnActivated

:

protected override void OnActivated(IActivatedEventArgs args)
{
    base.OnActivated(args);

    if (args.Kind == ActivationKind.Protocol)
    {
        var protocolArgs = args as ProtocolActivatedEventArgs;

        var rootFrame = new Frame();
        rootFrame.Navigate(typeof(MainPage), protocolArgs.Uri.AbsoluteUri);
        Window.Current.Content = rootFrame;
        Window.Current.Activate();
    }
}

      

Check this page for a more detailed explanation.

+5


source


Take a look at the activation of the protocol . The example of starting an association should provide a sample that you can customize for your needs.



For example, the Bing Maps app has a pretty extensive URI scheme (not that you can see how they implemented it, of course :))

+4


source







All Articles