AndroidManifest.xml 上 android:pathPrefix 中的问题带有特殊字符#
Issue in android:pathPrefix on AndroidManifest.xml with special character #
我有以下 link:
https://thus.customapp.it/#/app/customapp/itemDetail/45289348293423
我希望这个 link 被我的应用捕获并打开。所以,我在 AndroidManifest 文件中添加了这些行:
<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="https" android:host="thus.customapp.it" android:pathPrefix="/#/app/customapp/itemDetail"/>
</intent-filter>
我也试过:
<data android:scheme="https" android:host="thus.customapp.it" android:pathPrefix="/#/app/customapp/itemDetail/.*"/>
还有这个:
<data android:scheme="https" android:host="thus.customapp.it" android:pathPattern="/.*/.*/.*/.*/..*"/>
还有这个:
<data android:scheme="https" android:host="thus.customapp.it" android:android:pathPrefix="/#"/>
还有这个:
<data android:scheme="https" android:host="thus.customapp.it" android:pathPattern="/#/.*" />
但是没用。
P.S。使用以下代码:
<data android:scheme="https" android:host="thus.customapp.it" android:pathPattern="/.*"/>
它有效,但我只需要拦截包含 "itemDetail" 的 url,而不是 https://thus.customapp.it/#/app/customapp/editItem/45289348293423
使用
android:path="/%23/app/customapp/itemDetail/.*
而不是
android:pathPrefix="/#/app/customapp/itemDetail/.*"
编辑: 根据@panagulis72 的建议,我们应该使用 %23 而不是 #
我有以下 link: https://thus.customapp.it/#/app/customapp/itemDetail/45289348293423
我希望这个 link 被我的应用捕获并打开。所以,我在 AndroidManifest 文件中添加了这些行:
<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="https" android:host="thus.customapp.it" android:pathPrefix="/#/app/customapp/itemDetail"/>
</intent-filter>
我也试过:
<data android:scheme="https" android:host="thus.customapp.it" android:pathPrefix="/#/app/customapp/itemDetail/.*"/>
还有这个:
<data android:scheme="https" android:host="thus.customapp.it" android:pathPattern="/.*/.*/.*/.*/..*"/>
还有这个:
<data android:scheme="https" android:host="thus.customapp.it" android:android:pathPrefix="/#"/>
还有这个:
<data android:scheme="https" android:host="thus.customapp.it" android:pathPattern="/#/.*" />
但是没用。
P.S。使用以下代码:
<data android:scheme="https" android:host="thus.customapp.it" android:pathPattern="/.*"/>
它有效,但我只需要拦截包含 "itemDetail" 的 url,而不是 https://thus.customapp.it/#/app/customapp/editItem/45289348293423
使用
android:path="/%23/app/customapp/itemDetail/.*
而不是
android:pathPrefix="/#/app/customapp/itemDetail/.*"
编辑: 根据@panagulis72 的建议,我们应该使用 %23 而不是 #