Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Open Universal Link from within an app with OpenUrl

$
0
0

We have an iOS app that is configured to open universal links.
This works fine. When clicking on urls from a browser, notes or email-application, the app is opened and the correct action is taken.

However, these urls also occur within our app as labels that have a TapGestureRecognizer which opens the url as follows:

UIApplication.SharedApplication.OpenUrl(Uri);

When the label is tapped, that the url is opened in Safari, which then shows an app banner that allows the users to open it with the app.

I would expect it to open with the same app.

I did find a property on UIApplicationOpenUrlOptions: UniversalLinksOnly. This page http://useyourloaf.com/blog/openurl-deprecated-in-ios10/ definies this as follows:

Use a boolean value set to true (YES) to only open the URL if it is a valid universal link with an application configured to open it. If there is no application configured or the user disabled using it to open the link the completion handler is called with false (NO).

I tried this:

var options = new UIApplicationOpenUrlOptions ();
options.UniversalLinksOnly = true;
UIApplication.SharedApplication.OpenUrl(new Foundation.NSUrl(url.AbsoluteUri), options, null);

Strangely this blocks the url from opening at all, which would imply that the app is not registered. However opening the links from other apps works without problems, suggesting that the app is registered.

How can we get universal links from within an app to open with the same app?


Viewing all articles
Browse latest Browse all 204402


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>