【问题标题】:open Url in android in web browser application在 web 浏览器应用程序中打开 android 中的 Url
【发布时间】:2016-03-18 15:12:30
【问题描述】:
我正在开发 Web 浏览器。网络浏览器正在工作,但我需要帮助我的应用程序在单击时捕获 Android 系统的 url(http、https 等)并打开我的网络浏览器应用程序
像任何其他浏览器 chrome、firefox 等,这些应用程序如何打开默认应用程序选择菜单?
阅读这些我了解<intent-filter>被使用
有人可以帮助我将什么添加到清单文件和我的活动中,以便我的应用程序捕获 url?
【问题讨论】:
标签:
android
android-webview
intentfilter
【解决方案1】:
尝试将CATEGORY_BROWSABLE 添加到可以处理 URL 的活动中。
像这样:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<!--This makes activity an option for the default action (center press) to perform
on a piece of data. -->
<category android:name="android.intent.category.DEFAULT" />
<!-- Activities that can be safely invoked from a browser must support this category. -->
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="http" />
<data
android:scheme="https" />
</intent-filter>