How to interceptor iOS universal links in an App - ios

I work about universal links iOS recently. But I found out that in some App, my universal links can't open my App 100%. So, I want to know how to prevent a universal links to open a third part App in my App. Thanks!

Universal Links require explicit user interaction to engage. If navigation to Universal Links happens as a result of Java Script redirect, or server redirect or by navigation from another App, then Universal Links will not engage and user will stay in browser/webview. Also it is possible for the user to disable Universal Links for specific domain on specific device.
Alternatively, if you want to blacklist some pages of the website to be opened in the App you can edit AASA file to exclude these pages. See also this answer Hide "Open in app" banner while using Universal links
Does this answers your question?

Related

Open iOS application from universal links

I have implemented universal links in my application by uploading "apple-app-site-association" to my server and enabling "associated domains" in my project(by adding applinks). My app opens whenever I click on my server weblink from Safari browser.
1) Its not working on any other browser
2) I need to open my app from other apps as well, i.e. Instagram, Twitter etc.
How can I achieve the above scenarios using universal links. If not, is there any other way of achieving the same.
Not all apps will open universal links in you app. You can read a little more here:
"Pasting a Universal Link directly into the Safari URL field doesn’t cause the app to open automatically. If you do this, you will have to manually pull the website down so that a prompt will appear at the top asking you to open the respective app.
But, if you paste links in Facebook(app), Twitter(app), Mail(app) or even if you go to Facebook on Safari and then click on a universal link, the app opens directly.
Universal links will not works for all the apps in iOS. If you click on a universal link from any of the “BLACK LISTED” apps, it will not open the app. Go to this link to know more.
As in step one, for the first time you will have to manually pull down the website and click “open” to open the link using the respective app. The iOS will “remember” to open the app instead of opening the safari if the universal link with the registered domains are clicked."
https://medium.com/#abhimuralidharan/universal-links-in-ios-79c4ee038272
https://docs.branch.io/pages/deep-linking/universal-links/#appsbrowsers-that-support-universal-links

How to make google links (or any other links) to open our app?

I am developing a mapping application and I want that whenever a user clicks a google map's link or any other links (except a link from my own domain), it should show an option to open in my app as well.
How this can be achieved using Associated Domains?
If I'm -hopefully- not mistaking, what are you looking is Universal Links:
When you support universal links, iOS users can tap a link to your
website and get seamlessly redirected to your installed app without
going through Safari.
Remark: for supporting universal links, you have to have a paid Apple developer account.
Turning on the Associated Domains capability is one of the required steps to support the universal links into your application.
For more information, there is a good raywenderlich.com article about working with Universal Links.
Hope this helped.

Force Universal Links to open in Mobile Safari

I have a http link to a page. I want the users to stay in Safari when they click on this link, even if there is an app that has universal links enabled that should intercept it.
This was apparently possible in the past using target="_top" in an iframe, but it doesn't work.
Any idea?
Thanks!
If I'm understanding the scenario correctly, you have managed to configure Universal Linking for an app - and you have used the same associated-domains value for the app as is used on your website. Now, when tapping on links to the website, the app always opens.
Well, congratulations on getting Universal Linking working - this is something that many people struggle with!
To achieve the pre-Universal Linking beheavior of having links open the web site instead of opening your app, you will need to break Universal Linking. Fortunately, it seems much easier to break Universal Linking than it is to get it working:
At the risk of stating the obvious, you can change the link domain used in the app so that it is not the same as the web site.
Another option would be to turn off Universal Linking for the app in question on a per-device basis. To do this: open the app using a Universal Link and then click on the small button that appears in the upper right-hand corner of the screen - clicking on this button disables Universal Linking for the app on the device. Probably not what you are looking for.
Finally, you can deploy your links in such a way that Universal Linking will not be triggered. Apple requires that Universal Links be directly tapped on by the end user (see: https://forums.developer.apple.com/thread/26760). You can therefore prevent the app from opening by having users tap on a button or link (a shortened link, for example) that redirects to the website instead of opening it directly. The redirection will prevent the Universal Link from opening the app.

iOS 9+ Universal Links don't work from Google apps

The company I work for told me to ask the following:
When a universal link is tapped in other apps (native Apple apps, Slack, etc.) our app is opened, but if the same link is tapped in any Google app (Hangouts, Inbox, etc.) the universal link is not opened directly by our app.
We set the Google app to not open links inside it and we don't have Chrome installed on devices where the app was tested.
Does anyone have the same problem? Is there any solution for this?
Unfortunately this is the expected behavior. Universal Links do not work directly from within most Google apps — you need to have the link open a web page containing a button or other link within. That button or link can be a Universal Link, which then opens the app.
Here is more information about where Universal Links currently work and do not work.

iOS 9 Universal Links not launching the app from the same domain

I have setup my AASA JSON file to open the app when someone visits myDomain.com/ShowInTheApp/*
This works from Notes App, Email, Gmail App, Gmail web on safari and basically any other websites other myDomain.com .
When myDomain.com/chooseAppORweb.html contains a link to myDomain.com/ShowInTheApp/ , safari always opens it in the same tab, app wont get launched. I can tap and hold the link to show the context menu that contains an entry "Open In [My app name]" which will indeed launch my app. But not by single tapping on the link.
When I do the exact same steps from another domain, NOTmyDomain.com/chooseAppORweb.html always launches the app without issues.
Has anyone succeeded in launching the app consistently from the same domain using UL ?
Also, if there is an Apple's document that explains any of these behaviours, please share the link.
I'm not sure when Apple added this to their documentation, but it's explained on their Support Universal Links page, in the first note:
In iOS 9 and later, universal links let users open your app when they tap links to your website within WKWebView and UIWebView views and Safari pages, in addition to links that result in a call to openURL:, such as those that occur in Mail, Messages, and other apps.
When a user is browsing your website in Safari and they tap a universal link to a URL in the same domain as the current webpage, iOS respects the user’s most likely intent and opens the link in Safari. If the user taps a universal link to a URL in a different domain, iOS opens the link in your app.
For users who are running versions of iOS earlier than 9.0, tapping a universal link to your website opens the link in Safari.
(Emphasis added)
Essentially, once a user reaches a page hosted on your domain in Safari, any links they follow on your domain will be opened in Safari, even if they're defined as Universal Links by your app.
As st.derrick mentioned above, this is the in-place behavior for Universal links. If you have previously been taken to the App from the link, but then choose to be taken to the website when prompted with a long press, the functionality to open the App will break. You can remedy this by long-pressing again and choosing to open in-app. It's not an ideal solution, but it is the only way I've seen it be fixed. I hope this helps!

Resources