What are the changes need for working deeplink in Android 12
Asked Answered
L

1

7

The deep linking feature of my app was working fine with Android 11. But it is not working in Android 12. I checked and followed several StackOverflow posts and some other blogs. But I am getting the links unchecked in the app details

enter image description here

If I manually check it, the deep linking will work.

I tried manual verification by using the documentation and getting legacy_failure error. https://developer.android.com/training/app-links/verify-site-associations#manual-verification

I followed this URL too https://doordash.engineering/2022/01/25/your-deep-links-might-be-broken-web-intents-and-android-12/comment-page-1/?unapproved=40015&moderation-hash=dc9e7df0845c5072330edc78f75ca497#comments .

Lifeguard answered 22/4, 2022 at 4:54 Comment(3)
Did you solve the issue ? we got the same problem.Ingrained
This works for me. No custom scheme for autoVerify=true. https://mcmap.net/q/686251/-app-links-legacy_failure-verification-error-on-android-12Ice
Removing custom scheme saved me. Thanks @neobie!Ennead
C
4

This approach should solve deeplink issue on android 12 above

Automatic approach

skip step 1 & 2

Go to Tools/ App Link Assistance and follow the step on the image

enter image description here

Manual Approach

Step 1: update all intent filters that can respond to an HTTP link with the android:autoVerify="true"

<activity
android:name="com.example.MainActivity">
    <intent-filter android:autoVerify="true">

    </intent-filter>
</activity>

Step 2: Create the assetlinks.json file and update your package and sha key

  //update package_name and sha256_cert_fingerprints with yours
[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
  "namespace": "android_app",
  "package_name": "Your App’s package name", 
  "sha256_cert_fingerprints":  ["Your App’s SHA256 finger print"]
 }

}]

Step 3: Publishing the JSON verification file Work with your infrastructure team to deploy the assetlinks.json file to the host

https://your domain.com/.well-known/assetlinks.json

Be sure of the following:

  • The assetlinks.json file is served with content-type application/json.
  • The assetlinks.json file must be accessible over an HTTPS connection, regardless of whether your app's intent filters declare HTTPS as the data scheme.
  • The assetlinks.json file must be accessible without any redirects (no 301 or 302 redirects).
  • Do not publish your app with dev/test URLs in the manifest file that may not be accessible to the public (such as any that are accessible only with a VPN). A work-around in such cases is to configure build variants to generate a different manifest file for dev builds.
Chemisorption answered 12/7, 2022 at 12:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.