Search code examples
androidfacebookapplinks

Facebook applinks opens browser on Android


I'm trying to implement the applinks. Maybe I understand it utterly wrong, but I'm expecting this workflow:

  • create/enhance a web page with the meta headers (other content doesn't matter)
  • enhance the app with intent-filter responding to myapp scheme
  • post a link to this web page to Facebook
  • click this post on Facebook
  • it should open my app (or Google Play)

Is that correct?

The web page looks like this:

<html>
<head>
    <meta property="al:android:url" content="myapp://something/something">
    <meta property="al:android:package" content="packagename">
    <meta property="al:android:app_name" content="App Name">
    <meta property="al:web:should_fallback" content="false">
</head>
<body>
<script>
    window.location.replace('https://play.google.com/store/apps/details?id=packagename')
</script>
</body>
</html>

The app can be opened using the Intent (tested with adb shell am start -W -a android.intent.action.VIEW -d "myapp://something/something")

Now I create a post with link to this web page on Facebook (BTW will Messenger do, so I don't need to pollute my wall with testing?). Click it in the Facebook Android app.

I expect it to open my app, but it always opens the browser. Any ideas what's wrong?


Solution

  • The website must include og:type and og:title meta tags for it to work. This is a useful link for detecting these problems: https://developers.facebook.com/tools/debug/og/object/