【发布时间】:2021-06-12 08:38:14
【问题描述】:
我正在尝试使 Android 深度链接仅适用于特定网址,例如:
所以http://books.com/about 一直链接到网页
AndroidManifest.xml 中的此配置有效并在我的应用程序中打开正确的页面。问题是这匹配 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>
当我把数据部分改成:
<data android:scheme="https" android:host="books.com" android:path="/book/nice-book-1" />
或
<data android:scheme="https" android:host="books.com" android:pathPrefix="/book" />
或
<data android:scheme="https" android:host="books.com" android:pathPattern="/book/..*" />
只匹配 /book 后跟一个 slug,它不能全部工作。
我已经在 Stackoverflow 上发现了许多类似的问题,但它们要么已经过时,要么无法处理 url 与 slug 一起使用的情况。
- Android Navigation Deep Link - Ignore Query
- Intent filter using path,pathPrefix, or pathPattern
- How to use PathPattern in order to create DeepLink Apps Android?
是否有人在仅将几个 url 与 slug 匹配时遇到同样的问题?
【问题讨论】:
-
我也有同样的问题,android:pathPrefix="/ar/" 不起作用
标签: android ionic-framework deep-linking capacitor