Facebook deep link opens Google Play instead of app (even when installed)

半城伤御伤魂 提交于 2019-12-29 08:50:49

问题


I'm trying to use Facebook's new Mobile App Engagement for android, but I can't figure out why entering the ad takes me to my App's install page at Google Play, instead of opening my own app so I can handle the intent...

Here is what I've made so far:

1) At the "Native Android App" section (on App Basics Page), enabled "Deep Linking". The Key Hashes look ok, and Login with Facebook in my app works fine.

2) Created an engagement ad with Power Editor, and passed "myapp://type/id" as Deep Link

3) Added the following intent-filter to my app's main activity:

<intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT"/>
</intent-filter>

I've also tried other filters, like Dan's answer here

4) Clicked on the ad on my FB feed... At this step, I get the following at logcat, if using signed app (generated apk or downloaded from Play):

11-19 16:06:57.540: INFO/ActivityManager(446): START u0 {act=android.intent.action.VIEW dat=market://details?id=br.com.myapp flg=0x10000000 cmp=com.android.vending/com.google.android.finsky.activities.LaunchUrlHandlerActivity (has extras)} from pid 14923

If I enter the ad with my app installed from IDE (IntelliJ), than I get the log below:

11-19 16:10:30.845: INFO/ActivityManager(446): START u0 {act=android.intent.action.VIEW dat=market://details?id=br.com.myapp flg=0x10000000 cmp=com.android.vending/com.google.android.finsky.activities.LaunchUrlHandlerActivity (has extras)} from pid 14923
11-19 16:10:31.055: DEBUG/Finsky(16198): [1] AppActionAnalyzer.<init>: br.com.myapp is installed but certificate mistmatch
11-19 16:10:31.085: DEBUG/Finsky(16198): [1] DetailsDataBasedFragment.rebindViews: Page [class=DetailsFragment] loaded in [2947727 ms] (hasDetailsDataLoaded? false)
11-19 16:10:31.185: DEBUG/Finsky(16198): [1] AppActionAnalyzer.<init>: br.com.myapp is installed but certificate mistmatch
11-19 16:10:31.255: DEBUG/Finsky(16198): [1] DetailsDataBasedFragment.rebindViews: Page [class=DetailsFragment] loaded in [2947898 ms] (hasDetailsDataLoaded? true)

In both scenarios, Google Play is opened instead of my app. Seems like FB app is sending an Intent directly to market, passing my app's id, instead of following the activity class specified at App's dashboard. With IDE-installed APP, looks like I can't even receive anything from FB due to certificate problems...

So what am I doing wrong that makes FB not sending an Intent adressed to my App? And how can I link my debug certificate to my FB App, avoiding this certificate mismatch error? Thanks in advance for helping!


回答1:


Couple of things to try.

First, you need to add more to your intent filter, something like:

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="myapp"/>
</intent-filter>

Secondly, for the IDE-installed app, you need to generate a key hash for that (using your debug keystore), and add that to your list of key hashes on the developer dashboard.




回答2:


Make sure the Class Name field in your Facebook developers console contains the namespace as well. So not just MainActivity, use com.domain.appname.MainActivity instead.

More info on this (old) docs page.



来源:https://stackoverflow.com/questions/20079070/facebook-deep-link-opens-google-play-instead-of-app-even-when-installed

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