我已經成功實現了與我的應用的深層鏈接,但是我遇到了問題。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/">
我明白你的觀點。這對我來說是最後的選擇。但在此之前,我只需要知道我可以採取哪些解決方案來解決問題。 –