Search code examples
c#windows-10win-universal-appwindows-10-mobile

Launcher.QueryUriSupportAsync() - Not Working Windows 10 mobile


I am trying to find if the Facebook app is installed on a Windows 10 Mobile device so that authentication can be handled through the Facebook App instead of the WebAuthenticationBroker.

The following line of code always returns LaunchQuerySupportStatus.NotSupported

LaunchQuerySupportStatus uriAvailability = await Launcher.QueryUriSupportAsync(new Uri("fbconnect://authorize?client_id=.........", UriKind.Absolute), LaunchQuerySupportType.Uri);

If I bypass this check and go straight to Launcher.LaunchUriAsync then it opens the app as expected. However, I need to perform the above check to support the desktop version, but it just doesn't give me any response back other than Not Supported.

Any thoughts???

UDPATE
I have been able to get LaunchQuerySupportStatus.Available when using my own app protocol myapp://something/123/. I also found that I needed to add UriKind.Absolute in order for this to work.

However, still no change with the fbconnect:// protocol

UPDATE - 2
I have now tried

var apps = await Launcher.FindUriSchemeHandlersAsync("fbconnect");

and still get no results. If put the protocol of my own app in there, then I do get results.

Facebook is definitely installed if I miss this checking step then the launcher works and opens the Facebook app.


Solution

  • After a bit of researching in more detail, it looks as though the problem with this is that the current Facebook app is built for Windows Phone 8, and was written in Silverlight.

    When trying to perform the same action against Universal apps, both written by me, and by others, then both of the methods above work.

    As I am writing for pre-release then I can only hope that Facebook have an official Windows 10 Mobile app shortly after the launch so that this works as I plan.

    UPDATE
    I have just heard back from Microsoft to say that this issue is fixed in an internal build, and should be available to the public soon. Fingers crossed it will be in RTM for mobile. I'll update this once I see the fix is available - The code shown in the original question will be correct.