且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

带有Facebook的Android Deeplink无法正常工作-重定向到Play商店而不是启动应用程序

更新时间:2023-10-11 20:01:52

手动解决方案



您需要配置网站以处理 Facebook的应用程序链接(与Android应用程序链接不同)。为此,您需要将Facebook应用程序链接元标记添加到关联的网页。尽管我认为应用程序链接应该很好,但您也应该将应用程序配置为处理URI方案。

Manual Solution

You need to configure your website to handle Facebook's App Links (different from Android App Links). In order to do this you need to add the Facebook app link meta tags to the associated web page. You should also configure your app to handle URI schemes as well, although I think App Links should be fine.

<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应用程序已正确抓取您的元标记:

You will need to have these tags present on every one of your web pages that is associated with web content. You can then check to verify that your meta tags are being properly scraped by the Facebook app with using this curl command:

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

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

Will all of this configured, Facebook should properly deep link out of your app.

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

Branch has a solution already configured in the links. When a Branch link is created with an associated $fallback_url and your app is authenticated with FB (you can find how to do this in the docs), Branch will insert the correct meta tags for you. I highly recommend using this SDK as it will save you a lot of pain and heartache in your future deep linking endeavors.