这是否意味着目标 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/