Given the following URLS:
1. www.example.com
2. www.example.com/a
Via deeplinking, I want my app to only react on 1
and not 2
.
<data
android:host="*.example.com"
android:pathPrefix="/"
android:scheme="http"/>
This will, of course, catch all www.example.com/...
urls, how can I match only www.example.com
without any path and not match www.example.com/a
?
Here's what worked for me, set path empty and include a tools:ignore to avoid lint errors.
<data
android:host="*.example.com"
android:path=""
android:scheme="http"
tools:ignore="AppLinkUrlError"
/>
Using 'path' instead of 'pathPrefix' or 'pathPattern' worked, so:
<data
android:host="*.example.com"
android:path="/"
android:scheme="http"/>
matches www.example.com
as well as www.example.com/
, but not www.example.com/a
, so exactly what I wanted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With