Android Deeplink with facebook not working - redirecting to play store instead of launching application

和自甴很熟 提交于 2020-01-23 03:54:05

问题


I am trying to deep link my application with facebook. My App Url is https:www.xyz.com/app

Below is my intent filter:

<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>

I am posting a link in facebook, when someone click on the link, the link is getting redirected to Google play Store and asks the user to open the application if installed, instead of loading the class in which the intent filter is present.

Activity name has been specified in facebook developer account.

Please let me know what mistake am I doing.


回答1:


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>

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

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

More Robust Solution

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.



来源:https://stackoverflow.com/questions/47792132/android-deeplink-with-facebook-not-working-redirecting-to-play-store-instead-o

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!