Latest Update Below at Update #5
I'm trying to implement AppLinks for BOTH my iOS AND Android apps : http://applinks.org
I've done the following:
- setup a custom url scheme for my app: inacho://
- Setup in my App Delegate:
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
- Add meta tags to my website at http://www.nachorater.com :
<meta property="al:ios:app_store_id" content="581815579"/>
<meta property="al:ios:app_name" content="iNacho" />
<meta property="al:ios:url" content="inacho://default" />
I've verified that the url scheme works great by typing in a link like inacho://default into Notes and clicking the link it creates. Wa-la! It opens my app.
But when I try clicking on a link to www.nachorater.com from Facebook or Quip, neither app automatically seems to take any notice that the site has these app links setup and it just loads the website in their browser(s) instead of trying to open my app.
Has anyone got this working?
Update:
I had an issue with some meta tags not being in the < head > portion of my templates and I fixed it.
Now the link: http://www.nachorater.com from the iOS Facebook app adds a nice little popup that lets you open the url in the iNacho app like so:
But my links to my dynamic reviews do not seem to be working, yet the Debug app that Ming pointed out shows that the meta tags look correct for them.
For example, http://www.nachorater.com/getReview?reviewID=6396169718595584
meta tags when debugging with https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.nachorater.com%2FgetReview%3FreviewID%3D6396169718595584 :
Update #2:
I posted a new nacho review link to my iNacho Facebook timeline and then tried to click on it from the Facebook Mobile app.
It started to load the page and popped up the handy indicator that lets you open the app in iNacho but then once the page loaded, the indicator went away (before I could click it).
Update #3:
From the Facebook app, I can now trigger an inacho URL for my reviews BUT it's ONLY if I click the little popup to open in iNacho before it disappears. If I let the page completely load in Facebook's built-in web view, the little popup disappears still.
Is this a problem with Applinks? Or a problem with the Facebook app? Or by design and why?
Update #4:
I may know what the problem is. The review page in turn loads up a dynamic image for the nacho review. So by loading the page, it has an img src tag that points to a dynamic url that loads the image. Is this being mistaken for a 'redirect' action of some sort?
Example of img tag (rendered): <img width="300" src="/getReviewImage?imageID=6125868501958656"></img>
Note: There are a bunch of other scripts/ajax that gets loaded dynamically too though (Facebook and twitter widgets and the like).
Is this a bug in AppLinks or the Facebook Mobile app? Shouldn't it not care about background loading objects like ajax and dynamic images?
Update #5
7/15/14 - This is still happening with latest Facebook app. When I click a link from my iNacho Facebook page to my iNacho website, it pops up the option to open it in the app for a split second before the page finishes loading. Then it hides it.
As for the twitter app, it does not even give me the popup for a split second. It doesn't seem to recognize the link is appslink enabled at all.
Quip on the other hand, I pasted a nacho link in and the first time I clicked on it, it went to its built-in safari with no option to open in my app. BUT the second time I clicked it, it directly opened my app instead.
Summary: So far, it seems like maybe some apps are implementing the AppLinks Navigation portion incorrectly or something. Quip seems to work but even Facebook's own app seems like it's not working.
sorry if my answer is not exactly what you expect but just to share what we did on our websites and apps.
For instance, I know we had to add more tags to make it works with twitter cards and here is the list of the meta properties we have in our pages:
and the metha you also have:
we also have the facebook opengraph meta defined such as fb:app_id. I mention that because when you receive the deeplink in your app, you also have the facebook app id in the applinks link.
And from what we tested:
facebook does not open the deeplink directly on iOS whereas Android gives you the app choice. It sometimes shows up the blue popup at the bottom of the screen and sometimes you just have a link added in the actionsheet you have when you tap on the share button in the facebook (safari) webview (only at first load)-> this presentation of the link depends on how the content was shared on facebook.
twitter add a link to the app inside the card on iOS.
Don't know what I can add more.
Hope it helps a bit.
I was having the same problem with AppLinks and decided to just forego them altogether and just use facebook's app link host: https://developers.facebook.com/docs/applinks/hosting-api
My app is really mobile only, and I misunderstood how AppLinks worked at first. I thought I could just put the
al_ios_*
meta tags on a single, universal web page but this is wrong. There would need to be a separate page for every piece of content on my site, and each one of those pages needs to have its own AppLinks meta tags to send a URL for that specific content back to my app.When I was doing it wrong, when I tapped on my OpenGraph story in facebook, it would open my site in the web browser and there was an action icon in the bottom toolbar that I could tap and have the option to open my app. Or I would have to precision-tap the name of my app in the OpenGraph story. Either of those fast-switch to my app, but the URL would not be specific to the content I want my app to navigate to. Also, both of those options suck -- I just want to tap anywhere on the story and go straight to my app, which is why we're all here.
The solution
I am going to use an OpenGraph story with the share dialog as an example.
First, you need to create a hosted app link on your server, not in the app. Before creating your OpenGraph story or whatever is being shared, make a call to your server to accomplish 2 things:
1.) Make an API call to create a new facebook app link, which will give you back an ID
2.) Use that ID to make a 2nd API call to get the URL to your hosted app link
This has to be done on the server because these API calls require an app access token, not a user access token. This token has app level permissions, not user level permissions. You cannot and should not store your facebook app secret anywhere in your mobile application because someone could decompile your app and make changes to your facebook app. No good. Use your server because it can safely know your app secret.
My server side is in PHP so here is an example of how to accomplish this. Dealing with the API wasn't a particularly pleasant experience, so I'll share in hopes that it helps someone else with formatting the requests:
Back in your app, once you confirm a good response, put the canonical URL you get back as the
url
parameter in[FBGraphObject openGraphObjectForPostWithType:
below. Now when you click on your story in the facebook app, it will go straight to your app. No web nonsense.When I was working on my app, Sweep, I put a pay/share wall after a certain amount of time spent in the app. I faced the same problem where AppLinks really sucked at actually linking off of Facebook, despite the promise. Based on this problem, I built a service called branch.io that hosts the links for me, plus automatically inserts the correct AppLinks metatags for Android/iOS. The links actually work as expected, as crazy as that is. It uses a combination of client side JS with the AppLinks to make them properly redirect in every webview and native browser
Here's a high level guide to creating the share links on iOS:
To get started, you just need to configure the location of your app in either store on the dashboard at dashboard.branch.io. Once it's all setup, you get your Branch app key.
pod "Branch" or you can clone the open source repo here: https://github.com/BranchMetrics/Branch-iOS-SDK
Add the Branch key to your plist file as a String with the key 'branch_key'
Add the following code to your AppDelegate in the appropriate methods
In the didFinishLaunchingWithOptions:
In the openUrl for handling URI calls:
You can put this snippet anywhere you want to create a link:
Android is very similar in method calls and functionality and can be found on the site.