LittleFunny
LittleFunny

Reputation: 8405

Intent Filter on Android

I am reading the intent filter of the android, and having a few question need to ask.

  1. Do they match the filter within the same application or all of the applications?

  2. The scheme within the data tag, I have looked on the documentation on the android sdk website but no idea what it mean. It say scheme://host:port/path or pathPrefix or pathPattern

What is the host port and path .... What does the path relate to?

Upvotes: 2

Views: 3273

Answers (2)

bigstones
bigstones

Reputation: 15267

1) see @mikerowehl answer

2) data is referenced through Uniform Resource Indentifiers (URI's). In Android, scheme could be http, tel, file, content (don't know about others) and by specifying a certain scheme in a filter you're saying that your component can handle data provided that way.

host+port=authority. In case of a data whose scheme is http, host will of course be something like stackoverflow.com, port will probably be left unspecified (if you're accessing a proxy it could be 8080). In case of a content provider, the authority is by convention "the fully-qualified class name of the content provider (made lowercase)", without a port.

This should be the general idea. Documentation in this field is pretty scattered but you should be able to find information on a particular task (say opening email attachments) when you'll need.

Upvotes: 1

mikerowehl
mikerowehl

Reputation: 2238

1) Depends on the type of intent that was requested. See implicit vs explicit intents in the "Intent resolution" section of the docs:

http://developer.android.com/guide/topics/intents/intents-filters.html

If you name the component exactly then you know which activity will launch. Other intents name a generic action and can be matched by multiple activities. The user gets a menu asking which app they want to use to complete the action normally. For instance download the Firefox app from the Marketplace and click on a link in an email, you'll get a prompt asking if you want to use the Browser or Firefox to open the URL.

2) That's for intercepting a custom URL scheme or overlaying HTTP requests. Sounds like that not something you're interested in doing, you can safely ignore it unless you need to use it. If you do want more info about it there's a question with some good answers already:

Launch custom android application from android browser

Upvotes: 1

Related Questions