Android host intent filters on a wildcard Android host intent filters on a wildcard android android

Android host intent filters on a wildcard


Yes. After reading the Android code of IntentFilter.AuthorityEntry.match(), I can see that there is a way to put wildcard on host, but only to match the beginning of host. The rules are these:

  • Put * as the first character of the host.
  • Write the rest of of the host until the end.

This will work:

    android:host="*site.com"    android:pathPattern=".*"    android:scheme="http" />

It will catch links of:

  • www.site.com
  • site.com
  • mail.site.com

On the other hand the one below won't work:

    android:host="*.site.*"    android:pathPattern=".*"    android:scheme="http" />