gpt4 book ai didi

android - 深层链接 Intent 过滤器到特定的路径前缀?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:02:53 24 4
gpt4 key购买 nike

我已经在我的 Android 应用程序上启用了深度链接,并且运行良好。

但是,我希望 intent-filter 仅收听特定的 pathPrefixhttp(s)://(www.)mydomain.com/e 和不是任何其他 pathPrefix

这可能吗?我在 AndroidManifest.xml

中附加了我的 intent-filter 代码
<intent-filter android:label="My App Name">
<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.domain.com"
android:pathPrefix="/e" />
<data android:scheme="http"
android:host="mydomain.com"
android:pathPrefix="/e" />
<data android:scheme="https"
android:host="www.mydomain.com"
android:pathPrefix="/e" />
<data android:scheme="https"
android:host="mydomain.com"
android:pathPrefix="/e" />
</intent-filter>

最佳答案

通过那段 list ,您告诉您的设备启动包含该 Intent 过滤器的 Activity,所有 url 都有

  1. http 或 https 作为协议(protocol)
  2. www.mydomain.com 或 mydomain.com 作为主机
  3. /e 作为路径前缀

由于问题与 pathPrefix 相关,您的 Activity 将处理路径以/e 开头的所有 url。例如:

  • http(s)://(www.)mydomain.com/e - 匹配
  • http(s)://(www.)mydomain.com/eXXX - 匹配
  • http(s)://(www.)mydomain.com/e/a - 匹配
  • http(s)://(www.)mydomain.com/eXXX/a - 匹配
  • http(s)://(www.)mydomain.com/e?a=b - 匹配
  • http(s)://(www.)mydomain.com/Xe - 不匹配
  • http(s)://(www.)mydomain.com/X/e?a=b - 不匹配

关于android - 深层链接 Intent 过滤器到特定的路径前缀?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31755039/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com