Miguel Ribeiro
Miguel Ribeiro

Reputation: 8184

Check if any app can handle URI scheme

I'm creating a Windows Phone 8 app (Store apps) in which I will have some links for the user to open other apps. My goal is to hide or show only the links for which I have apps that can handle them.

For instance, I have a link for

mymoneyapp://user=123

and another for

mymusic://user=123

So, if I have an app that can handle the mymoneyapp scheme I want the link to show if not then I hide it.

The only why I found to test this is using

LauncherOptions options = LauncherOptions();
options.FallbackUri = new Uri("http://myfallbackpage.com");
Launcher.LauncherUriAsync(new Uri("mymoneyapp://user=123"), options);

But in this case I get my fallback Uri launched if no app can handle that schema. Is there any way just to test if an app can launch it without actually do it?

Upvotes: 1

Views: 459

Answers (1)

Rob Caplan - MSFT
Rob Caplan - MSFT

Reputation: 21899

There is no API for this on Windows Phone 8. Windows 10 adds Launcher.QueryUriSupportAsync to allow checking if there is a handler before launching it.

https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.launcher.queryurisupportasync.aspx

Upvotes: 1

Related Questions