android - CATEGORY_BROWSABLE 的真正含义是什么?

标签 android android-intent categories

这是否意味着目标 Activity 允许自己由 Web 浏览器启动,还是意味着目标 Activity 可以响应 URL 请求?如果我想编写一个可以处理来自隐式 Intent 的 URL 请求的应用程序,我是否需要在应用程序的 Intent 过滤器中包含可浏览类别?

最佳答案

What does CATEGORY_BROWSABLE really mean?

引用 the documentation :

Activities that can be safely invoked from a browser must support this category. For example, if the user is viewing a web page or an e-mail and clicks on a link in the text, the Intent generated execute that link will require the BROWSABLE category, so that only activities supporting this category will be considered as possible actions. By supporting this category, you are promising that there is nothing damaging (without user intervention) that can happen by invoking any matching Intent.

在实践中,浏览器似乎主要将此与 ACTION_VIEW 一起用于点击链接(然后,仅当浏览器决定不处理链接本身时)。

Does it mean that the target activity allows itself to be started by a web browser

是的,或多或少。从技术上讲,任何应用都可以选择将此类别添加到其 Intents - 没有法律要求此类应用必须是 Web 浏览器。

If I want to write an app that can handle a URL request from an implicit intent ,do i need to include the browsable category in the app's intent filter?

如果您希望网络浏览器(或选择行为类似于网络浏览器的其他应用程序)找到您的 Activity ,那么是的。否则,不。

关于android - CATEGORY_BROWSABLE 的真正含义是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40658283/

相关文章:

android - Android 中 Facebook 和 Google+ 登录的 onActivityResult 代码

android - 添加图像资源但图像显示为空白

Android 锁屏通知无法双击打开浏览器

android - 测试Android类时如何使用 Intent ?

java - Android 应用程序在 TextView 中启动 Intent 并使用 setText() 后崩溃

php - 如何按名称从类别的子类别中获取帖子?

php - 使用 PHP+MySQL 显示带有子类别和 n-sub 类别的类别

Android 多点触控 : Pointers with index > 0 not triggering event. Action_Move

Android - applicationWillTerminate 等效

magento - Magmi 类别 描述 导入