Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force open app using Apple Universal Linking

I have Universal Linking setup in my app.

Now when browsing my website in Safari and visiting a UL registered link, it opens in safari and asks me if I want to open in my App.

Is there a way that it always opens in the app? No prompt to open in app, just open when it is installed, else continue in safari.

like image 238
Robert Broersma Avatar asked Dec 22 '16 10:12

Robert Broersma


People also ask

Can you open an app with a link?

Open Links Directly in App And Not Browser On Android. On Facebook, YouTube, and Twitter for Android, every link you click opens in the in-app browser by default.

How do I enable universal links in iOS?

How do I set up Universal Links for my app? Log into your Apple developer account and go to the app's ID page. Enable the Associated Domains app service. Take note of your Prefix (bundle ID) and your ID (team ID) - you will need them later.

What are Apple Universal links?

Universal links are HTTPS or HTTP URLs that represent your content both on the Web and in your app. They allow users to open your content in your app instead of in a Web browser, allowing you to provide a richer experience.


1 Answers

There are two different issues here:

1. In Safari, the URL of a Universal Link needs to be on a different domain/subdomain than the page on which it appears

Apple is very conservative with where Universal Links are allowed to work. One of the limitations in Safari is not allowing the app to open if the user is already browsing the same site (this sort of pages sense — if the user made the effort to open a site in Safari instead of the app, it could be annoying if every single link on that site tried to open the app, especially if the app isn't properly configured for deep link routing).

The workaround is to use a separate domain/subdomain for links you want to open the app. For example, if your site is on example.com, point any link you want to open the app to link.example.com and then redirect users without the app back to the main website or onward to the App Store. This is actually the system we built at Branch.io (which you could consider using instead of re-building it yourself!)

2. What you have described is not Universal Links behavior

Universal Links do not ask the user for confirmation before opening the app, even the first time. They always open the app immediately without even requesting the web page, until/unless the user explicitly disables them (which is actually rather easy to do). What you're describing is the behavior of custom URI schemes, so I suspect you may have a some sort of automatic redirect to the app's URI scheme on the page the Universal Link points to. This is actually not the best idea in most cases, since users without the app will see a nasty error message.

like image 142
Alex Bauer Avatar answered Oct 16 '22 21:10

Alex Bauer