Applinks does not work correctly on Android

Hello,

I try to setup the applinks for the app with Ionic/Angular v7.2.0 and Capacitor v5.2.2.

For IOS, it works fine with the file apple-app-site-association and the capability Associated Domains. So, when I click on a link to the associated domain, the app opens.

For Android, however, it does not work and so, when I click on a link to the associated domain, the browser opens and goes to the website. (I have tried with Xiaomi Redmi Note 11 with Android 13)

Could you help me?


For the settings, I have followed the instructions here and defined this:

  1. In AndroidManifest.xml
<intent-filter android:autoVerify="true">
	<action android:name="android.intent.action.VIEW" />
	<category android:name="android.intent.category.DEFAULT" />
	<category android:name="android.intent.category.BROWSABLE" />
	<data android:scheme="https" android:host="app.myassociateddomain.com" />
</intent-filter>
  1. At the root of the domain directory, I have added a folder .well-known
  2. I have generated a new SHA256 certificate and copy the generated fingerprints (75:B2:2…).
  3. In the folder .well-known, I have added a new file assetlinks.jsonwith this content:
[{
	"relation": ["delegate_permission/common.handle_all_urls"],
	"target" : {
		"namespace": "android_app",
		"package_name": "com.mypackage.name",
		"sha256_cert_fingerprints": ["75:B2:2…"]
	}
}]

After several tests, it did not work well on some devices.

For example, on Samsung, the applink is well detected and the app opens but on Xiaomi, the applink is not detected. So, I have added a fallback redirect to the Play Store and when the user arrives in the website of the Play store, it is redirected to the application of the the Play store with an alert that propose to open the app.

So it works but differently depending on the device.

i have the same problem here, but in my case i’m using the android emulator it automatically redirect to the browser, does that mean that it does not work on the emulator ? is there a work around to this please ?

Hey,

Yes, I don’t arrive to use it with the emulator too.
Also, as I said, it works as expected on some device but some other does not really detect correctly. I suppose it depends on the device type and the software version :confused:

For example, I tested on two read Android devices.
On Samsung, it opens the app but on Xiaomi, it doesn’t open directly the app.

However, I advise you to test on a real device if possible.