Need more info regarding intent-filter tag specified in manifest. I am aware that we can specify data in two forms:
Complementing @CommonsWare answer, it appears that you cannot use two <data>
tags if you are not so specific.
A) In one of my apps I can have:
<data android:scheme="myAppScheme1"/>
B) And
<data android:scheme="myAppScheme2" android:host="host2"/>
C) But the following will ignore the first tag (using myAppScheme1://whatever
URI won't work):
<data android:scheme="myAppScheme1"/>
<data android:scheme="myAppScheme2" android:host="host2"/>
D) However if I complement the first scheme it will work for both URIS:
<data android:scheme="myAppScheme1" android:host="host1"/>
<data android:scheme="myAppScheme2" android:host="host2"/>
Probably if you really need the case C), you'll better create two intent-filters
I am aware that we can specify data in two forms
Do not use content
for a scheme, unless you truly mean that you are creating an activity in support of a ContentProvider
.
But I wish to know can several combinations exist
If your filter has just one attribute for <data>
, you definitely can have different values, such as this from the Contacts app:
<activity
android:name=".activities.ShowOrCreateActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="com.android.contacts.action.SHOW_OR_CREATE_CONTACT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="mailto" />
<data android:scheme="tel" />
</intent-filter>
</activity>
Also, one component can have several <intent-filter>
elements, each of which is logically OR'd with the others (any Intent
matching any filter is a match for the component). So for more complex scenarios, where you have 2+ attributes per <data>
element, I would be inclined to put those in separate <intent-filter>
elements.
how is it decided that which host to be used for which scheme
Any match is considered good. You would examine the Intent
yourself to learn more about what it contains.