【问题标题】:Android intent filter with pathPattern matches in assistant but not workAndroid意图过滤器与助手中的pathPattern匹配但不起作用
【发布时间】:2017-07-25 11:45:59
【问题描述】:

我正在尝试创建一个应用链接来打开我们的应用而不是浏览器。

应用程序链接助手告诉我该模式工作正常,但是当我在模拟器或物理设备上尝试时它不起作用:(

过滤器:

<activity android:name=".activities.AppLinksActivity">
         <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:scheme="http"
                 android:host="www.emagister.com"
                 android:pathPattern="/.*-cursos-.*.htm"

                 />
         </intent-filter>
     </activity>

要匹配的网址:http://www.emagister.com/curso-avanzado-lenguaje-programacion-javascript-cursos-2863146.htm

助理留言:

Assistant image pic

但是当我在设备上打开它或单击运行测试时,我无法正常工作并打开浏览器。

如果我将 android:pathPattern="/juridico-master-compliance-officer-controller-juridico-empresarial-cursos-3299291.htm" 放在清单中,而不是上述路径模式,一切正常。

我做错了什么?

提前致谢!!

【问题讨论】:

  • 您是否尝试过使用 https 添加另一个数据标签?即

标签: android deep-linking applinks


【解决方案1】:

您的pathPattern 正则表达式似乎不必要地复杂;我不相信这里使用了哪个正则表达式解析器的文档,但如果它在某种程度上窒息,我不会感到惊讶。

尝试尽可能简化,然后再添加元素(但尽可能少)。我怀疑pathPattern='.*cursos.*' 仍然会得到同样的结果。

【讨论】:

  • 感谢亚历克斯的回答。我知道它已经很老了。我认为OP想要强烈限制。这就是 OP 添加特殊符号和其他细节的原因。我们可以在正则表达式中添加对符号检查的支持吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-08-09
  • 1970-01-01
  • 1970-01-01
  • 2015-10-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多