2

I have a web page in place with proper App Links tags; the relevant ones for the Android part are:

<meta property="al:android:url" content="custom-scheme://some/url/with?q=1&s=2">
<meta property="al:android:package" content="com.example.app">
<meta property="al:android:app_name" content="Example App">
<meta property="al:web:should_fallback" content="false">

Sharing content from the Android application, by posting on Facebook a link to a web page containing those tags, just works. However, when I click on the post from the native Facebook application, my Android application receives an Intent with a data property set to the original shared link instead to the app link specified in the al:android:url metadata.

I expected that, having set the al:web:should_fallback metadata to false, the original URL would not be shown, and the defined app link would be picked. But the only difference I see in the Intent is on its action: instead of being a regular android.intent.action.VIEW, it is some weird com.facebook.application.720295239734539.

Which is the right metadata combination to have Facebook correctly using the custom-schemed URL I defined in al:android:url as the deep link carried by Intent's data to my app?

Giulio Piancastelli
  • 15,368
  • 5
  • 42
  • 62
  • Those look correct...you aren't by any chance also specifying an `al:android:class` meta tag? – Alex Bauer Mar 10 '16 at 12:47
  • @AlexBauer no `al:android:class` meta tag is included. I am currently wondering if the strange data I receive in the Intent are just temporary - some kind of placeholder that Facebook uses while it waits to execute the task to actually parse the app link metadata on the page, which would maybe queued somewhere instead of being executed immediately after the sharing. – Giulio Piancastelli Mar 10 '16 at 14:31
  • Hmm...I don't think that would make sense, as I believe the applinks tags are crawled on request. If the task hadn't finished, presumably your app wouldn't even launch. I've seen some weird behaviour in the past with caching though — perhaps Facebook is working with an old version of your page? Might be worth running it through the [object debugger](https://developers.facebook.com/tools/debug/og/object/) – Alex Bauer Mar 10 '16 at 15:10
  • Another option could be using a service like [Branch.io](https://branch.io), since it abstracts out a lot of these technical details. That way you won't have to worry about whether the applinks tags are correct, or how to handle the incoming intents. – Alex Bauer Mar 10 '16 at 15:23
  • @AlexBauer I just checked, and a deep link I posted yesterday that had the weird behaviour I describe in the question today opens my app with an Intent featuring the regular action and the correct URL. If this is not a proof of some sort of queued task on Facebook's side, I don't know what it is. The page is fine by the object debugger (but would the debugger be able to spot a missing `should_fallback` set to `false` that prevents deep links to work on iOS?). I know that even Facebook offers a deep link generation service, but I really would like to stay away from those. – Giulio Piancastelli Mar 11 '16 at 11:33
  • Glad it's working! Possibly the applinks tags weren't correct the very first time you tested it. Facebook would have cached that version of the page and used it for all future tests even after you updated the tags. The debugger clears the cache but it also refreshes itself over time, which would explain why things work today. I don't think there is any sort of queue, because the applinks tags are crawled immediately (this is what allows Facebook to show the rich content preview as soon as you paste in a link to share). The debugger *should* show everything, including `should_fallback` – Alex Bauer Mar 11 '16 at 12:11
  • Out of interest, what is your aversion to deep link generation services? Even with this issue resolved, it still only covers links that are posted to Facebook, when an Android user opens them. What about links posted elsewhere, or when opened by iOS users? Or by Android users on the Facebook mobile web app instead of native? There are a **ton** of edge cases that can be a real headache to manage on your own! – Alex Bauer Mar 11 '16 at 12:15
  • 1
    @AlexBauer I have made another test, deep link didn't send an Intent with regular action and correct link at first, but it worked correctly after a couple of hours. So, uhm, I still believe there is something fishy going on on the Facebook's side, but I'm not going to explore further. Deep link generation services are third party services, and I worry about them shutting down, making my apps lose features that would be a PITA to implement without relying on them. Besides, edge cases are important for the frequency with which they happen, not the sheer / raw / absolute number of them. – Giulio Piancastelli Mar 11 '16 at 19:01

1 Answers1

1

To summarize findings for anyone else who stumbles onto this question:

It appears the applinks tags are not resolving immediately for some reason, leading to an intent with irregular actions. However, everything works as expected after waiting a few hours. The Facebook Object Debugger seems not to be helpful for expediting the process.

Alex Bauer
  • 13,147
  • 1
  • 27
  • 44