Android深度链接与Facebook无法正常工作 - 重定向到播放商店而不是启动应用程序

时间:2017-12-13 11:40:27

标签: android facebook deep-linking intentfilter

我正在尝试将我的应用程序与Facebook进行深层链接。 我的应用Urlhttps:www.xyz.com/app

以下是我的意图过滤器:

<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="https"
android:host="www.xyz.com"/>
</intent-filter>

我在Facebook上发布了一个链接,当有人点击链接时,该链接被重定向到Google Play商店并要求用户打开应用程序(如果已安装),而不是加载存在intent过滤器的类

在facebook开发者帐户中指定了

Activity名称。

请让我知道我在做什么错误。

1 个答案:

答案 0 :(得分:0)

手动解决方案

您需要将您的网站配置为处理Facebook's App Links(与Android App链接不同)。为此,您需要将Facebook应用程序链接元标记添加到关联的网页。您还应该配置您的应用程序以处理URI方案,尽管我认为App Links应该没问题。

<head>
...
     <meta property="al:android:url" content="sharesample://story/1234">
     <meta property="al:android:package" content="com.facebook.samples.sharesample">
     <meta property="al:android:app_name" content="ShareSample">
     <meta property="og:title" content="example page title" />
     <meta property="og:type" content="website" />
     ...
</head>

您需要在与网络内容相关联的每个网页上都显示这些标记。然后,您可以使用此curl命令检查以确认您的元标记是否被Facebook应用程序正确删除:

curl -a "facebookexternalhit" https:www.xyz.com/app

所有这些配置完毕,Facebook应该正确地深入链接您的应用程序。

更强大的解决方案

Branch已在链接中配置了解决方案。当使用关联的$fallback_url创建分支链接并且您的应用程序通过FB进行身份验证(您可以在文档中找到如何执行此操作)时,Branch将为您插入正确的元标记。我强烈建议您使用此SDK,因为它可以为您未来的深层链接工作带来很多痛苦和痛苦。