Abhishek Bansal
Abhishek Bansal

Reputation: 5355

AppLinks(verified Deeplinks) in android does not work when app is installed from Google Play

We have a few intent-filters defined in AndroidManifest for deeplinks. We also have assetlinks.json file placed on our domain at proper location with correct SHA fingerprints. We are facing a weird issue where these App links open our app directly without any chooser in between when app is installed from Android Studio.

Which is also desired behaviour, but, when we upload our app to Google play and download from there these App links open App chooser first which is not desired behaviour.

We did some experimentation like creating different intent filters for two different links, removing one link etc but this behaviour remains same. Also double checked SHA fingerprints, they seemed to be fine.

Upvotes: 4

Views: 5962

Answers (2)

Yousif
Yousif

Reputation: 569

I know there is an accepted answer, but there's another scenario that someone else may face as I did.

When publishing to Google Play, if your app has "App Signing by Google Play is enabled for this app.", then it doesn't matter what is your keystore SHA256 when signing your apk on your local machine.

You need to use the SHA256 from Google Play Console -> Relase management -> App signing -> App signing certificate.

Edit (2021): App signing key certificate is in a different location now:

  1. Select the app from the console.
  2. Go to Release section.
  3. Under Setup, select App Integrity.

Upvotes: 18

Shahbaz Hussain
Shahbaz Hussain

Reputation: 620

If you're saying that you have your assetlinks.json file at a proper location, and the JSON itself has correct statements. Then there can be two issues

  1. Check whether you've added autoVerify=true in your AndroidManifest.xml file for the activity in which you've defined the intent filter.

  2. Recheck the signed apk's SHA256 to confirm you're using correct SHA256 to sign your apk. You can check that using the command

keytool -list -printcert -jarfile <your_signed.apk>

and verify that the same SHA256is present in your assetlinks.json file.

  • To validate whether your app is actually resolved your app link, use the command
./adb shell dumpsys package domain-preferred-apps

The output would be like:

Package: com.test.example
Domains: www.test.com
Status:  always : 200000000

Package: com.test.example
Domains: www.xyz.com
Status:  ask
.
.
.

Find your app's package name, then check the Status for your package name, if it is always : <some_number> then your apk is correctly verified and the app link should work alright, otherwise if value of Status is ask or undefined, then there is some issue which you can refactor following the above-mentioned steps.

Upvotes: 10

Related Questions