Is there a way to check universal link registration from Safari? - ios

iOS has a universal link capability (https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html).
However, it looks like there are couple of ways to "disassociate" a link from the application:
Press and hold on a link and choose "Open in Safari"
There was a tiny link in the top right corner of the app, which was shown right after opening universal link (it looks like it's gone in iOS 11).
As soon as you did one of these actions then universal link will be opened in Safari (until you reassociate it back to the app).
The issue is that if a user end up in this state, it's not clear what he/she should do. I want to provide an explanation on the web page which will be opened in Safari.
However, I want to distinguish two cases:
A link is clicked on a device without the app: Tell a user to download the app
A link is clicked on a device where the app is installed and it's disassociated. Tell a user how to associate it back.
Is there a way to check whether universal link is registered from a page opened in Safari?

Yes, you are correct that iOS 11 took away the upper-right hand corner button to re-enable universal links. They have kept the banner that shows up when you scroll the page up slightly.
This banner acts will also re-enable Universal Links for the user.
Unfortunately, there is no perfect solution to determining if a user has the app installed, but there are a few ways to attempt to deduce whether the user has the app installed already. Branch has ways of deducing whether the user has the app installed and attempting to open it with a URI scheme. You can read about the $uri_redirect_mode in the docs.
It would be very difficult to build this deducing method on your own and I'm not entirely sure how it's done, so I recommend using Branch's solution.

Related

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.

Branch.io Deeplink not working in safari in ios 9, But it works in chrome

Deeplinks working perfectly when using chrome iOS app. But in safari it stopped working and it always redirect to the appstore page even the app is installed or sometimes pop a alert saying "safari cannot open the page because the address is invalid". Everything works perfect few days back. so my guess is this happens after the ios 9.2 update. Any solution for this?
UPDATE
I have tried using a new phone(Which app not installed before) and installed the app.
Deep links works for both browsers (Safari and Chrome).
If you push the bnc.lt forward button it opens App Store for both Safari and Chrome.
Next time you open a link deep link:
Safari: It asks if you want to open the link in app store
Chrome: It asks if you want to open app and at the same time redirects to app store. If you click open in app next time you click a deep link it will open in app.
So in other words you can still open the app from Chrome after clicking the bnc.lt forward link in staus bar. This is because Chrome asks for opening the app and not app store.
For Safari i end up in an irreversible state where the deep link always open app store and not the app.
Alex from Branch here: this is the expected behavior. Unfortunately our fallback options are rather limited at the moment, due to the changes to Universal Links in iOS 9.2.
TL;DR: it's a bit of an edge case that most users wouldn't encounter, but you can easily work around it by making use of our Deepviews functionality.
Basically, here's the logic behind what you're seeing:
When you open the link on a device without the app installed, you end up on our bnc.lt server, and we redirect you to the App Store so you can get the app. This is good.
When you open the link on a device with the app installed for the first time, your device detects the Universal Link and opens the app immediately. All this happens locally on your device, and you never even get to our bnc.lt server. This is also good.
When you push the bnc.lt forward button, you're telling your device 'I don't want you to immediately open the app...show me the web content for this link instead'. In the case of a Branch link, this 'web content' is simply a redirect to the App Store. At this point, Branch has no way to know whether you the app is installed or not, so we have to assume it isn't and you get the same treatment as 1. above. This is not so good, but right now we don't have any better options due to the way Apple has designed the system.
The next time you open a link, your device remembers that you pushed the bnc.lt button in the past and just takes you straight to the web content. I'm not sure why Safari does it this way, because I can't imagine many situations where this would be desirable and it is leading to a lot of confusion for users.
The real problem here is that when you press bnc.lt to bypass the app, your device remembers this preference and executes it every time it sees a bnc.lt link in future. Chrome still 'works' because it is proactively confirming the preference each time in 4., whereas Safari just plows forward. There are a few options for what happens next:
In Apple's ideal world, you'd end up on a normal webpage where you could simply scroll up and use the Open in app button to reverse this preference. But since Branch is immediately redirecting you to the App Store, this isn't an option. You could consider using our Deepviews feature, since this does provide some real web content in place of the immediate App Store redirect you're seeing right now.
In most situations, you can still long-press on the link and select Open in app, but this doesn't help users who don't know the option is there.
In the worst-case scenario, you end up on the App Store page and just press the Open button (instead of Install). Thanks to Branch's magic, you'll still end up in the right place!
Now from iOS 9.2, Apple no longer supports URI schemes for deep
linking, developers must implement Universal Links in order to deep
link properly on iOS.
Universal links let you replace custom URL schemes with standard HTTP or HTTPS links. Universal links work for all users: If users have your app installed, the link takes them directly into your app; if they don’t have your app installed, the link opens your website in Safari.
To learn all about universal links, see
How to support Universal Links in iOS App and setup server for it?
Example
https://github.com/vineetchoudhary/iOS-Universal-Links
UPDATE [1]
How Branch links work (Branch.io)
If you take a lock at fundamentals of Branch's contextual deep links. You found Branch.io also using traditional deep-linking
1. Creating links
When you’ve integrated the Mobile SDK, you can create a Branch link every time a user clicks to share or invite another user from within your app. Your app makes a call to Branch.io, and Branch.io return a Branch link.
2. Tying data to links
3. Clicking links
4. Using data
Check the Clicking links step, Branch.io just map your website URL with your app URI scheme but URI schemeno longer supported by Safari. So, move to Universal Links is only the option in order to deep linking in iOS 9.2 or you can wait for some solution by Branch.io. Thanks.

iOS Deep linking and Universal link, how to deep link in ios

I read that from iOS 9, Universal links are introduced. Please explain the different between Deep-linking and universal links.
My objective is, a link will be sent in mail to customers. Let the mail says there is an offer for item A, and a link. On clicking the link
If the app is installed then, open the app and launch specific screen showing item A
If app is not installed then, download it from App Store and open it and launch specific screen showing item A
What if there is a user login feature?
If app is installed and user is not logged in then,
open the app
Launch login screen
After login is success launch specific screen showing item A.
How can these be implemented? How the links are configured for these?
As of iOS 9.2, released December 8th, 2015, Apple has sounded the death knell for URI scheme based redirects, the standard for deep linking for the last seven years. They’ve decided that Universal Links are the future.
Earlier in order to use a URI scheme, you have to manually handle the case of the app not being installed.The problem with this is that when the app is not installed, it shows a ‘Cannot Open Page’ error. I’m sure you’ve all seen it. It’s the bane of deep linking.We were able to bypass this in iOS 7 and iOS 8, but it is not possible now from iOS 9.
Get more details form this link
To clarify, 'deep links' are simply links that, when clicked, cause your app to open directly to content. Universal Links are a type of deep link, as are URL scheme links, but neither is a perfectly bulletproof solution right now so to cover all edge cases, you'll want to implement both.
Fortunately Branch can handle all of that complexity behind the scenes so you don't have to worry about it! As mentioned in the answer above, the guide here will get you up and running with exactly the implementation you described!
I found a usable link here . It gives step by step details about deep linking using Branch.io

Universal Links - disable top right link

I currently complement my web application by using URL Schemes to launch my native application. Starting with iOS 9 my users now get challenged with a popup that says "Open in app name". I have figured how to eliminate this by using Universal Links using a different domain then the app I'm launching from but have encountered an issue.
Key points
App is distributed outside of the app store as an Enterprise Distribution. So if I understand correctly smart app banners do not apply.
In case my app is not installed, my universal link web location hosts a page on how to install it.
If a user launches the app but does not have it installed they properly get my install page
Once in the app if the user presses the domain link at the top right they will not be able to launch the app again
The problem Im encountering is that if a user ever presses on the link/bread crumb at top right the app will not launch anymore. It will always direct the user to the install page. I know if I pull down on this page there is an open button that will take me to the app, or if I long press on my link I can also have it launch my app. However, I will not be able to get my users to understand this.
Is there a way to turn off the link on the top right?

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