我已经成功实现了与我的应用的深层链接,但是我遇到了问题。Android深层链接省略了特定的网址
<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:host="*.example.com"
android:scheme="https"/>
</intent-filter>
这个意图过滤器处理所有的联系,但我不希望赶上某些URL即
https://www.example.com/hello/redirect/
我试了一下,到目前为止:
我试图进入所有的我想要手动捕捉的网址
<data
android:host="*example.com"
android:scheme="https"
android:pathPrefix="/m/">
<data
android:host="*example.com"
android:scheme="https"
android:pathPrefix="/c/">
<data
android:host="*example.com"
android:scheme="https"
android:pathPrefix="/p/">
...
但t当我的主页URL https://www.example.com
不起作用。
如果我使用
android:pathPrefix="/"
,那么这将再次开始捕获所有的网址,包括我想省略的URL。
我也尝试过使用android:pathPattern
,但它不能理解像这样的复杂正则表达式^((?!redirect).)*$
,当我在字符串和全部字符串中尝试它时,它工作正常。
任何人都知道如何省略某些网址?
UPDATE:
正如@PLNech here建议,我说,我需要使用android:pathPrefix
赶上并使用android:path: "/"
的所有URL赶上我的主页即的URL https://www.example.com/
<data
android:host="*.example.com"
android:scheme="https"
android:path="/"/>
<data
android:host="*example.com"
android:scheme="https"
android:pathPrefix="/m/">
<data
android:host="*example.com"
android:scheme="https"
android:pathPrefix="/c/">
<data
android:host="*example.com"
android:scheme="https"
android:pathPrefix="/p/">
我明白你的观点。这对我来说是最后的选择。但在此之前,我只需要知道我可以采取哪些解决方案来解决问题。 –