gpt4 book ai didi

android - Web 浏览器应用程序 - 如何拦截 URL Intent ?

转载 作者:行者123 更新时间:2023-11-29 18:31:25 25 4
gpt4 key购买 nike

我有一个自定义 ROM,除了 WebView Browser Tester 之外没有默认浏览器。我开发了自己的网络浏览器应用程序(webviewclient Activity )并将其安装在手机中。现在我希望当用户点击手机时,无论 URL 是什么,我的浏览器应用程序都会拦截并加载该 URL。这是我在 intent_filter 中使用的内容

 <intent_filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent_filter>

但它不工作,仍然 WebView 浏览器测试器应用程序启动和加载链接。有人可以告诉我如何将我的应用程序设置为默认浏览器应用程序或使用任何特殊 Intent 来帮助在单击任何 URL 时启动此 Activity 吗?

最佳答案

尝试添加两个 Intent 过滤器

        <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="http"
android:host="*"/>
</intent-filter>
<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="*" />
</intent-filter>

关于android - Web 浏览器应用程序 - 如何拦截 URL Intent ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56059744/

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