- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
Documentation states可以在 pathPattern 中使用通配符。
A period followed by an asterisk (".*") matches any sequence of 0 to many characters.
因此,我创建了以下过滤器:
<intent-filter android:priority="600">
<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"/>
<data android:scheme="https"/>
<data android:host="*"/>
<data android:pathPattern="/.*.exe"/>
</intent-filter>
但是,它并不对所有以“.exe”结尾的链接“有效”。
适用于这些链接:
https://subdomain.site.org/lite/appinst-lite-vc.exe
https://subdomain.site.org/appinst.exe
不适用于此链接:
https://subdomain.freedownloadmanager.org/5/5.1-latest/app_x86_setup.exe
看来,它不适用于在其 path
部分带有额外点的链接。
我是否遗漏了什么或者是 Android 错误(代码或文档中)?
附言此过滤器捕获所有这些链接:
<intent-filter android:priority="600">
<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"/>
<data android:scheme="https"/>
<data android:host="*"/>
<data android:pathPattern="/.*"/>
</intent-filter>
最佳答案
是的,你是对的。是 .
导致了问题。
与正则表达式不同,在路径模式中,匹配将在模式第一个字符的第一个匹配处停止。换句话说,* 匹配是非贪婪的。
一种解决方案是添加多个模式,如下所示。添加的越多,数量或 就越多。
它可以没有问题。
<data android:scheme="http" android:host="*"
android:pathPattern=".*\\.exe" />
<data android:scheme="http" android:host="*"
android:pathPattern=".*\\..*\\.exe" />
<data android:scheme="http" android:host="*"
android:pathPattern=".*\\..*\\..*\\..exe" />
<data android:scheme="http" android:host="*"
android:pathPattern=".*\\..*\\..*\\..*\\.exe" />
另一个解决方案是使用 this图书馆。
关于android - 奇怪的 Intent 过滤器 pathPattern 行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51912180/
我需要为名为 myfile.ext 的单个文件定义 IntentFilter。目前我的 list 看起来像:
我找到了很多方法来设置 pathPatterns 以应用于某些目录或文件。我需要从一般模式中排除一个目录。 我有一个带有 pathPattern="/.*" 的 InstantApp intent-f
在我的应用程序中,我试图让它在有人单击浏览器上的链接时打开一个 Activity 。我正在使用这个数据 block ,但它不起作用。 例如,当我点击 www.test.com 时,它打开了应用程序,
我正在尝试制作类似 downloadmanager 的东西,但我在使用 intent-filters 时遇到了麻烦。我用于捕获文件下载 Intent 的 Intent 过滤器是这样的:
我希望我的应用能够处理以下自定义 url myscheme://product?id=123。这按预期工作。但是,以下 url 也得到处理 myscheme://product/something/e
因此,我当前用于更新对象的服务遵循以下 URL 的格式 http://www.baseurl.com/servicemethodAddObject/transactionId?clientTime=c
在我的应用程序中,我想处理使用以下模式的链接: scheme://host/folder1/folder2/folder3/folder4/article 我使用以下命令让它暂时工作:
我正在向我的 android 应用程序添加一个 intent 过滤器,我希望它能够捕获发送到 http://www.somedomain.com/[numericValue] 的请求。如果路径是数字,
我正在尝试让 Android 深层链接仅适用于特定的 url,例如: https://books.com/book/nice-title-of-a-book https://books.com/boo
我希望我的应用程序继续一些网络链接。我在 list 中为此添加了 intent-filter。它看起来像这样:
我正在使用下面的 Intent 过滤器将 Activity 与"file"方案的三种自定义扩展名相关联:.smmx、.smmstyle 和 .mm
我已经阅读了很多关于此的其他 SO - 特别是对这个问题的高度投票回答:Android intent filter for a particular file extension? 我的场景比较简单—
我们有一个 android 应用程序可以打开某些类型的文件。我已经在 AndroidManifest.xml 文件中为每个人声明了一个 Intent 过滤器(示例扩展名:ext):
不确定这是否可能,但希望有人有解决方案。 我试图让我的 Android 应用拦截 mydomain.com/abc 形式的 url,但不是 mydomain.com/mp3/id 是否有可能使用 pa
Documentation states可以在 pathPattern 中使用通配符。 A period followed by an asterisk (".*") matches any sequ
我想为这两个 http url 创建深层链接 https://sample-app-123.appspot.com/backoffice/#/user_reset_password?email=abc
我已阅读有关在 android studio 3.0 中创建深层链接和使用应用程序链接服务的文档。它非常简单易懂,但是当我的 URL 没有前缀路径时我遇到了一点问题。示例: https://examp
我正在尝试制定一个过滤某些特定网址的 Intent 。我要捕获的网址是: > http://host.com/app > http://host.com/app/ > http://host.com/
我是一名优秀的程序员,十分优秀!