【问题标题】:Issue in android:pathPrefix on AndroidManifest.xml with special character #AndroidManifest.xml 上的 android:pathPrefix 问题,带有特殊字符#
【发布时间】:2019-07-09 12:05:28
【问题描述】:

我有以下链接: https://thus.customapp.it/#/app/customapp/itemDetail/45289348293423

我希望这个链接被我的应用程序捕获并打开。所以,我在 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="/#/.*" />

但它不起作用。

附:使用以下代码:

<data android:scheme="https" android:host="thus.customapp.it" android:pathPattern="/.*"/>

它有效,但我只需要拦截一个包含“itemDetail”的网址,而不是,例如,https://thus.customapp.it/#/app/customapp/editItem/45289348293423

【问题讨论】:

  • 你遇到了什么错误?
  • 没有错误,但是如果我点击链接,它将使用 Chrome 而不是应用程序打开
  • 您检查过简单链接吗?
  • @GOVINDDIXIT 我编辑了我的问题,也许它可以帮助
  • 尝试使用 android:path="/#/app/customapp/editItem/45289348293423" 而不是 android:pathPattern="/.*"

标签: android nativescript android-manifest nativescript-angular


【解决方案1】:

使用

android:path="/%23/app/customapp/itemDetail/.* 

而不是

android:pathPrefix="/#/app/customapp/itemDetail/.*"

编辑: 正如@panagulis72 所建议的,我们应该使用 %23 而不是 #

【讨论】:

  • 现在app拦截了url,但是我现在遇到了相反的问题!事实上,如果我选择打开 Chrome 的链接,它会给我 404,因为 /%23/ 的 url 不存在,只是 /#/ 存在
  • 如果这对您有帮助,请告诉我:stackoverflow.com/questions/11587744/…
  • 我试过但它不起作用,所以我改变了方式并在我的网络应用程序上构建了一个重定向页面,并通过查询参数传递参数(即使查询参数被忽略:@987654322 @)。无论如何,非常感谢您的帮助!
猜你喜欢
  • 2016-07-18
  • 1970-01-01
  • 2016-03-07
  • 1970-01-01
  • 2021-07-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多