How exactly Facebook AppLinks work on iOS? - ios

I have found one related question: Cannot get the new AppLinks to work on iOS or Android But I am not sure if it is entirely similar with the problem that I am facing. Thus, I created this question.
If I understand correctly from: https://developers.facebook.com/docs/applinks/ios
When I click on a proper applink with the proper meta data:-
Case 1: I have the app installed:
Expected Action 1: It will navigate to the specific page inside the app.
Case 2: I do not have the app installed:
Expected Action 2: It will direct me to the app store page of the app to download.
Here are the configurations that I have done so far:-
The App Link URL: http://watchoverme.parseapp.com/
The App Link Meta Data:
<html>
<head>
<title>Watch Over Me</title>
<meta property="al:ios:app_store_id" content="431208868"/>
<meta property="al:ios:app_name" content="Watch Over Me" />
<meta property="al:ios:url" content="watchoverme://promotion" />
<meta property="al:web:url"
content="https://itunes.apple.com/app/id431208868?mt=8" />
</head>
<body>
Yo!
</body>
</html>
On the app side, I have added the custom url scheme like the screen shot below:-
So far, I have tested a few scenarios below:-
Scenario 1: I created another simple app with a single Button to open the applink.
The code for the button:-
- (IBAction)appLinkTapped:(UIButton *)sender {
NSLog(#"appLinkTapped");
UIApplication *app = [UIApplication sharedApplication];
NSString *path = #"watchoverme://promotion";
NSURL *ourURL = [NSURL URLWithString:path];
/*
if(![app
canOpenURL:ourURL]){
path = #"http://watchoverme.parseapp.com/";
ourURL = [NSURL URLWithString:path];
}*/
[app openURL:ourURL];
}
Result 1: If I have the WatchOverMe app installed and I tap the button, I can open the WatchOverMe app. Great!. But if the WatchOverMe app is not installed and I tap on the button, nothing happens. Should I be directed to the iTunes App store to download the app? Or I did something wrong?
Scenario 2: I posted the link (http://watchoverme.parseapp.com/) on Facebook and try to tap on the link on my mobile.
Result 2: Whether I have the app installed or not, it only shows me the blank website.
The question: Am I missing something here on the configurations until it can not trigger the expected applink behavior above?
Thanks
Update #1
Thanks Ming Li for pointing me to the right direction. I want to understand better on how app link works. So, I have done more testings and here is what I have found:-
From the the screen shot above:
Case A: I share the app link using the Watch Over Me app (you will see "via Watch Over Me")
Result A: When I tap on the link on the Facebook App. If I have the Watch Over Me App installed, it will redirect me to the app. If I do not have the app installed, it will redirect me to the iTunes App store to download. It is working great!
Case B: I share the app link using status update only. (without via Watch Over Me)
Result B: It will only open the blank webpage.
So, the Applink only works when we post the applink via Facebook? And not posting the Applink via our status update?
Update #2
I have tested again on 1 September 2014. Both cases above have been working well! A big Thanks Ming Li.

For everyone else who doesn't work at Facebook and understand what they mean by "indicating that your app is mobile only" here is what I have found from testing:
It appears they are using the "al:web:should_fallback" meta property as a check for if your app is "mobile only" and has no web presence. This doesn't make sense as far as I can tell based on how the App Links spec defines it but what do I know.
Anyway, if you want your Facebook post to go straight to the deep link in your app and not open up the jarring webview with random app link UX treatments by Facebook then add the following meta property to your html page:
<meta property="al:web:should_fallback" content="false" />
Of course this now prevents you from sending users without the app installed to anything but the app store. However, since the webview is usually just a repeat of the Facebook post in the first place that's probably a worthwhile tradeoff.

Since you have not indicated that your app is mobile only, it would follow the "No" arrow from the original decision box, and show your webpage along with some call to actions for either open or install.
Facebook is always testing different UX treatments, so what you see may not be what other people see. I tried posting a status update with your url, and everything is working as expected.

Related

iOS Facebook App Link not working

I am trying to set up App Links so that:
a) When I tap on a link on the Facebook app, it opens my app if installed
b) If not installed, Facebook should not prompt the user to be directed to the App Store, and instead open the link in the in-app browser
I have been experimenting with the al:web:should_fallback meta tag, but there have been some mixed results:
When al:web:should_fallback is set to false, scenario a) as above works correctly, as expected. Scenario b) is not fulfilled, as expected, because I've indicated that the system should not fall back to the web.
However, when setting al:web:should_fallback is set to true, even though the app is installed, scenario a) no longer works.
Why is this? I am under the impression that al:web:should_fallback controls scenarios for when the target app is not installed
Some setup details:
My website's meta tags are as follows (Actual values replaced by "_"):
<meta property="al:ios:app_store_id" content="_" />
<meta property="al:ios:app_name" content="_" />
<meta property="al:ios:url" content="_://_" />
There are no outstanding warnings on the OG Debugger
There is only one warning on the App Ads Helper, and this relates to Deferred Deep Linking, which according to the App Links iOS documentation, is no longer supported
Any insight would be greatly appreciated!

Custom URL scheme without confirmation prompt (Swift)

I've found two options to open my app from a Safari web page: a custom URL scheme created in my app project's Info.plist or Apple's Universal Linking. Obviously the custom URL scheme is the easiest one to set up, but the problem I'm having with this is that Safari shows a confirmation window asking "Open myapp?" first and the user has to tap OK before the app actually opens. I want my app to open automatically as the scheme is opened, and I'm being told the only way to do this is through Universal Linking (please correct me if this is not true). If this is true, however, I would like to know if it's possible in any way to put the required apple-app-site-association file on a http:// domain instead of https://? According the official Apple documentation the format of a correct Universal Link starts explicitly with https:// but my domain name can't be loaded on https:// without redirecting a few times and that messes up the web services I've written to execute other tasks in my app. The two main questions I'm left with after this issue:
1) Is it really impossible to work around the confirmation prompt using a custom URL scheme (myscheme://)? If it's not impossible, how can I do this?
2) If I have to use Apple Universal Linking, can I use a http:// domain? If so, how do I do it? Right now if I load up the universal link, it just shows the dictionary inside the apple-app-site-association file, which I'm pretty sure is not supposed to happen. I'm told it's supposed to send a NSUserActivity object to my app delegate. How can I accomplish this with a http:// link?
It is not possible to trigger a custom URI scheme without showing an alert to the user. This used to be possible in iOS 8, but iOS 9 started showing the alert for all apps. And iOS 10.3 has extended that even to the App Store itself. You cannot bypass this. Universal Links were created to replace URI schemes for this behavior, so you do need to use them instead.
From your description, I believe you may be misunderstanding how Universal Links work. To answer the literal questions you asked first, no the Universal Link URL itself does not need to be on the https:// protocol, and yes, the apple-app-site-association must be served over https:// without redirects.
However, it sounds like you're trying to serve the content of the apple-app-site-association file for every Universal Link. That is not the correct implementation — the AASA file is hosted only at https://example.com/apple-app-site-association, and iOS automatically retrieves it when the app is installed. After that, any URL on example.com that matches the criteria in the AASA file will be eligible for Universal Links.
All of that said, you really don't want to built out this system on your own. I suggest looking into Firebase Dynamic Links or Branch.io (full disclosure: I'm on the Branch team).
Is it really impossible to work around the confirmation prompt using a custom URL scheme (myscheme://)? If it's not impossible, how can I do this?
That is possible with some hacky tricks and BAD user experience. It requires user to press "add to home screen" button, so I don't recommend this solution in most cases.
set your app scheme like myapp
create the following html file and put it into the web
window.onload = function() {
if (("standalone" in window.navigator) && window.navigator.standalone) {
window.location.href = 'myapp://open'
}
}
open the html file with safari and "add to home screen"
open the home screen icon and your native app will launch
The point is the meta tag.
<meta name="apple-mobile-web-app-capable" content="yes" />
Without this, safari will launch and confirmation prompt will appear.

Open iOS App by http:// link

I found a lot of tutorials about opening an app by a custom url scheme like:
myappname://
Thats nice but it would be great to open an app by registering the real app domain over the http link like
http://www.myappdomain.com/blablabla
So - for example - if a visitor comes to a webpage (on her/his mobile) it is normally opened in the browser, excepts the installed app is listening to the opened URL and opens itself instead of the browser.
How is this done (i've seen this at another app). Any help would be great. Thanks in advance!
It is a new feature in iOS9. It is explained in the WWDC15 talk Seamless linking to your App.
You could also add a small piece of javascript to each page that opens your custom URL-scheme.

iPhone Safari bookmark creates new session

I have a strange problem with a website I've developed for one of our clients. What I'll do is bookmark the home page using the "add to homescreen" Safari menu item. I will then browse around for a while and then go back to the phone's home screen, e.g. if someone calls me or I'm checking mail or whatever it is iPhone users do. When I tap the bookmark on the homescreen, I will be taken to the login page. When I log in, I'm taken to the home page as normal, but if I try to navigate anywhere else, the link opens in a new browser instance. I know this because my bookmarked link opens a Safari session in full screen mode, but the new browsed link opens a Safari session with the address bar and other goodies visible. I then have to log in again, but this time everything works fine.
It's only when I use the bookmarked link that it does this weird login thing. THe site works perfectly well on desktops (Mac and PC) as well as Android and Windows Phone 7.x and 8.x devices.
Right, so anyway, the problem was that another developer added the meta-tag <meta name="apple-mobile-web-app-capable" content="yes">. What that does is tell IOS that the webpage supports offline mode. Unfortunately, ours doesn't. I changed the tag to <meta name="apple-mobile-web-app-capable" content="no"> and all was well.
It's not a problem in our case because the meta tag was put there by mistake. We simply needed the meta tag for the nice homescreen icon and the above tag was also in the code snippet.

How to check if user installs a mobile app within a web page?

I know this is possible because today I browsed a mobile web page that said I have installed their native app, and prompted me to read their content in the app. (I haven't logged in, so they must have used some native checking mechanism.)
I know the web page can call out a native app by loading a custom url scheme like 'myapp://some/path', but how does it check if the url scheme exists before loading it? I want to do the same thing with my web app.
And I was seeing this on iOS, is this possible in Android, too?
The native checking mechanism is called Smart Banner. Apple added it to MobileSafari in iOS 6 and higher.
You add the following to your web page:
<meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL">
The custom URL scheme is the way to go.
They probably delivered a transparent image by that custom URL, and checked if their image delivery mechanism was hit.
So in essence:
You download page
The page prompts your browser to hit their "checking service" (image with custom URL scheme?)
The page checks if the call to the checking service succeeded. If so, it prompts you to use the native app

Resources