My AndroidManifest.xml
contains:
<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="books.com" android:pathPrefix="/book" />
</intent-filter>
And it is opening my app with the correct page when running
adb shell am start -a android.intent.action.VIEW -d "https://books.com/book/my-book-123" -c android.intent.category.BROWSABLE
or
adb shell am start -a android.intent.action.VIEW -d "https://books.com/book/my-book-123" com.books.app
When I send https://books.com/book/my-book-123 via email or message app, it just opens the browser when I tap it.
If I remove android:pathPrefix="/book"
it works, but then every url will open the app while I only want to open the books.com/books
urls
I've checked that in my phone that books.com does not have set the "always open" set to my browser.
1条答案
按热度按时间yshpjwxd1#
According to this , Web links are deep links that use the HTTP and HTTPS schemes. On Android 12 and higher, clicking a web link (that is not an Android App Link) always shows content in a web browser. On devices running previous versions of Android, if your app or other apps installed on a user's device can also handle the web link, users might not go directly to the browser. Instead, they'll see a disambiguation dialog.
Android App Links Android App Links, available on Android 6.0 (API level 23) and higher, are web links that use the HTTP and HTTPS schemes and contain the autoVerify attribute. This attribute allows your app to designate itself as the default handler of a given type of link. So when the user clicks on an Android App Link, your app opens immediately if it's installed—the disambiguation dialog doesn't appear.
So in a few words, you have to prove that you own that domain to be able to do what you´re trying to do, otherwise the web browser will load the URL.