Android深层链接省略了某些网址

Android深层链接省略了某些网址,第1张

概述我已成功实现了对我的应用程序的深层链接,但我遇到了问题. <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <cat 我已成功实现了对我的应用程序的深层链接,但我遇到了问题.
<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:host="*.example.com"       androID:scheme="https"/></intent-filter>

此意图过滤器处理所有链接,但我不想捕获某个URL,即

https://www.example.com/hello/redirect/

到目前为止我尝试了什么:

我尝试输入我想要手动捕获的所有网址

<data   androID:host="*example.com"   androID:scheme="https"   androID:pathPrefix="/m/"><data   androID:host="*example.com"   androID:scheme="https"   androID:pathPrefix="/c/"><data   androID:host="*example.com"   androID:scheme="https"   androID:pathPrefix="/p/">...

但是我的主页网址https://www.example.com不起作用.

如果我使用

androID:pathPrefix="/"

然后这将开始再次捕获所有URL,包括我想省略的URL.

我也尝试过使用androID:pathPattern,但它无法理解像这样复杂的正则表达式^((?!redirect).)* $当我在字符串中尝试它时,它工作正常.

有谁知道如何省略某些网址?

更新:

正如@PLNech here所建议的那样,我使用androID:pathPrefix添加了我需要捕获的所有URL,并使用androID:path:“/”来捕获我的主页的URL,即https://www.example.com/

<data   androID:host="*.example.com"   androID:scheme="https"   androID:path="/"/> <data  androID:host="*example.com"  androID:scheme="https"  androID:pathPrefix="/m/"> <data  androID:host="*example.com"  androID:scheme="https"  androID:pathPrefix="/c/"> <data  androID:host="*example.com"  androID:scheme="https"  androID:pathPrefix="/p/">
解决方法 Android deep linking mechanism没有提供从AndroID深度链接机制明确排除某些URL的方法:你可以 either包含androID:path路径显式路径,包含与androID:pathPrefix匹配前缀的路径,或者匹配带有androID:pathPattern的通配符,你可以使用* 要么 .*.

在您的情况下,您必须使用“/”并使用您的应用程序(包括您的主页)打开您网站的每个链接,或者让每个深层链接共享一个共同的前缀.

您还可以查看airbnb的DeepLinkDispatch库,该库似乎是allow excluding specific URLs.

总结

以上是内存溢出为你收集整理的Android深层链接省略了某些网址全部内容,希望文章能够帮你解决Android深层链接省略了某些网址所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1149373.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存