androidsubdomainintentfilterdeep-linkingapplinks

Multiple subdomain support with App Links


I've been reading the docs for supporting app links for android and the website my app supports works with subdomains but there's too many subdomains and they are built dynamically. I was wondering if there is a way to support many subdomains without having to specifiy them all in the intent-filter tag.

Here is the link to the example from google: http://developer.android.com/training/app-links/index.html#request-verify The example is in the Supporting app linking for multiple subdomains location.

I thought a regex would work but apparently that's not supported when defining the host. I don't want to list all of them since that would mean having to push a new release with every new subdomain created

<activity ...>
    <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" />
        <data android:host=".*.example.org" />
        <data android:pathPattern="/.*" />
    </intent-filter>
</activity>

I would prefer not to use a third party lib or service.. But any suggestions that work for you would be appreciated to understand how to make this work.


Solution

  • Quoting from: Verify Android App Links

    Alternatively, if you declare your hostname with a wildcard (such as *.example.com), you must publish your assetlinks.json file at the root hostname (example.com). For example, an app with the following intent filter will pass verification for any sub-name of example.com (such as foo.example.com) as long as the assetlinks.json file is published at https:/ /example.com/.well- known/assetlinks.json:

    <application>
      <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="https" android:host="*.example.com" />
        </intent-filter>
      </activity>
    </application>
    

    It seems the previous answers are outdated and Android now does has a support for wildcard in host name. As per the documentation it is now supported.