Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
591 views
in Technique[技术] by (71.8m points)

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

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...