I have to open some urls in my app instead of web browsers.
url examples should open in app:
https://www.example.com?deeplink=some
https://www.example.com/?deeplink=some
https://www.example.com/product/glass?deeplink=some
https://www.example.com/product/type/?deeplink=some
url examples should not open in app:
https://www.example.com/product
I have managed to handle filtering with sspPattern like this:
<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" />
<data android:sspPattern="//www.example.com/?deeplink=.*" />
<data android:sspPattern="//www.example.com?deeplink=.*" />
<data android:sspPattern="//www.example.com/.*?deeplink=.*" />
<data android:sspPattern="//www.example.com/.*/.*?deeplink=.*" />
</intent-filter>
Also i uploaded the assetlinks.json to the https://www.example.com/.well-known/assetlinks.json
But still when i click the url, it opens on web browser (chrome).
If I disable the chrome and try to click the link, this time opens in my app.
When I try to test by adb without putting my package name, it triggers com.android.chrome/org.chromium.chrome.browser.ChromeTabbedActivity
,
adb shell am start -W -a android.intent.action.VIEW -d "https://www.example.com/glass?deeplink=some"
When i give my app package name:
adb shell am start -W -a android.intent.action.VIEW -d "https://www.example.com/glass?deeplink=some" my.package.name
it opens in my app.
Does anybody have any idea why is it still being caught by chrome even i publish my assetlinks.json
file and set android:autoVerify="true"
?
Thanks a lot.