androiddeep-linkingmobile-developmentapplinks

Using wildcard in host attribute for android 12 AppLinks does not work ( android:host="*.example.com" does not work but www.example.com does )


If I use a wildcard to define deeplinking in Android 12 does not work it fails with legacy_failure if I run pm get-app-links com.example.app in adb shell but if I use a specific domain, the it works. So if I use

<data android:host="*.example.com" android:pathPrefix="/profile/" />

it gives me legacy_failure

but if I use

<data android:host="www.example.com" android:pathPrefix="/profile/" />

it works fine, and verifies. Wildcard usage should be possible based on documentation, and it worked in previous versions ( if I fun my app on a device with < 12 version of android it works just fine )

https://developer.android.com/training/app-links/verify-site-associations#multi-subdomain

I need to catch every subdomain, because we have a lot for this project - any idea how can I overcome this is much appreciated :)

( I made sure that everything from https://developer.android.com/training/app-links/verify-site-associations is correct )


Solution

  • The assetlinks.json file is supposed to be served directly, without redirects. Apparently, in some scenarios, the redirect is OK, but not in other scenarios. Somebody else ran into the same problem as you, and the redirect was the culprit.