'Android deep links not working due to supported web addresses being disabled by default

My app used to work fine with deep links, I haven't changed anything in the app but what has seemed to change is that when freshly installing the app, in the app settings - Set as default - Supported web addresses my website url that the deep links are supposed to work off of is disabled as default, I have to enable it manually to make it work.

How can I make it install with this being enabled automatically



Solution 1:[1]

After spending a whole day on that questions, here is my solution: For me, my apk had a different package name from that in the my-domain.com/.well-known/assetlinks.json

I found it out only after examining it with this service

My suggestion if you ran into that problem

  1. check that your .well-known has no errors in he

https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://my-domain.com&relation=delegate_permission/common.handle_all_urls

  1. After installing the apk, check that the deep link verification is ok by using this commands if they are not verified, they will appear with that toggle switch turn off.

3.If you still have that problem you can examine the adb logcat of your device and see the error why this verification failed.

Solution 2:[2]

This is happening due to a recent change introduced in Android 12. As per the documentation:

Starting in Android 12 (API level 31), a generic web intent resolves to an activity in your app only if your app is approved for the specific domain contained in that web intent. If your app isn't approved for the domain, the web intent resolves to the user's default browser app instead.

Before Android 12, opening generic web URLs which were added as a deep link in AndroidManifest showed a dialog to choose between the app and the browser. Starting Android 12, developers are expected to:

  1. Add android:autoVerify="true" to the web URL intents for which Android will verify if the domain is associated with the same app. These associated deeplinks are also called Android App Link.s (doc link)
  2. Declare the association between your website and your intent filters by hosting a Digital Asset Links JSON file at the following location: https://domain.name/.well-known/assetlinks.json (doc link)

After this, when the app is installed and Deep link (Android App Link) is triggered, Android will verify the association and directly open the deeplink in the app (it'll not show the app chooser dialog as well in the intent.)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 amitgur
Solution 2 Mayur Dhurpate