2

I need multiple hosts for app linking in my manifest file, but this doesn't work. If I add an other data tag with another host in the same intent filter.. the data tag that was working before doesn't work anymore. The same with multiple intent-filters. If I try to add another intent-filter for that other host, the first host (and the second host) doesn't work.

here you can see what I did:

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:host="www.host1.com"
                android:pathPattern="/path/.*"
                android:scheme="https" />
</intent-filter>
<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:host="www.host2.com"
                android:pathPattern="/path/.*"
                android:scheme="https" />
</intent-filter>

If I remove intent-filter with host2, host1 will work!

any ideas?

Cedric Data
  • 21
  • 1
  • 2

2 Answers2

3

Citation from documentation When android:autoVerify="true" is present on any one of your intent filters, installing your app on devices with Android 6.0 and higher causes the system to attempt to verify all hosts associated with the URLs in any of your app's intent filters.

Most probably you don't have assetlinks.json under your host2. So the systems checks both hosts to be authorized, and host2 fails, so the whole verification fails, including host1.

P.S. Having different activities with their intent filters will not help as well. Documentation link here.

Hayk Nahapetyan
  • 4,452
  • 8
  • 42
  • 61
-1

try adding this intent filter to diffrent activity than the other one , or try to create multiple virtual entry point for each host name .

i know its not ideal but it will do the trick

also reference here for more on how to achieve it :

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

example:

<activity android:name=”MainActivity”>

    <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="http" android:host="www.example.com" />
      <data android:scheme="https" />
    </intent-filter>
  </activity>
  <activity android:name=”ShadowActivity1”>
    <intent-filter>
      <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="www.example.net" />
    </intent-filter>
  </activity>

<activity android:name=”ShadowActivity2”>

    <intent-filter>
      <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="www.example123332.net"/>
    </intent-filter>

  </activity>
Enad
  • 21
  • 5