I am trying to make Android deeplinking work only for specific urls e.g.:
So http://books.com/about keeps linking to the webpage
This configurations in my AndroidManifest.xml
works and opens the correct page in my app. The issue is that this matches every page on books.com
<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="@string/custom_url_scheme" />
<data android:scheme="https" android:host="books.com" />
</intent-filter>
When I change the data part into:
<data android:scheme="https" android:host="books.com" android:path="/book/nice-book-1" />
or
<data android:scheme="https" android:host="books.com" android:pathPrefix="/book" />
or
<data android:scheme="https" android:host="books.com" android:pathPattern="/book/..*" />
to match only /book
followed by a slug, it does not work a all.
I've already found many similar questions on Stackoverflow but they are either quite dated or not handle the situation where an url works with slugs.
Does anyone have run into the same issues when matching only a few urls with slugs?
It took me a very long time to figure this out. So I'll answer my own question to save others precious time.
It turned out that when running an Android app on a device via Android studio
<data android:scheme="https" android:host="books.com" />
Is the only path that will work.
When using:
<data android:scheme="https" android:host="books.com" android:path="/book/nice-book-1" />
or
<data android:scheme="https" android:host="books.com" android:pathPrefix="/book" />
These will only work when using a SIGNED version of the app on your device. This probably because in your assetlinks.json
there is a sha256_cert_fingerprints
which can only be verified when a signed app is used.