user3591494 user3591494 - 21 days ago 6
Android Question

What does CATEGORY_BROWSABLE really mean?

Does it mean that the target activity allows itself to be started by a web browser or does it mean that target activity can response to URL requests ? 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?

Answer

What does CATEGORY_BROWSABLE really mean?

Quoting 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.

In practice, browsers seem to mostly use this with ACTION_VIEW, for clicks on links (and then, only if the browser decides to not handle the link itself).

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

Yes, more or less. Technically, any app can choose to add this category to its Intents — there is no law requiring such an app to be a Web browser.

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?

If you are expecting Web browsers (or other apps that choose to behave like Web browsers) to find your activity, then yes. Otherwise, no.