Configuring Other Intent Filters

The Android operating system uses Intent filters to resolve implicit intents.That is, Intents that do not specify the Activity or Component they want launched. Intent filters can be applied to Activities, Services, and BroadcastReceivers.The filter declares that this component is open to receiving any Intent sent to the Android operating system that matches its criteria.

Intent filters are defined using the <intent-filter> tag and must contain at least one <action> tag but can also contain other information, such as <category> and <data> blocks. Here we have a sample intent filter block, which might be found within an <activity> block:

<intent-filter>

<action android:name="android.intent.action. VIEW" />

<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category. DEFAULT" /> <data android:scheme="geoname"/> </intent-filter>

This intent filter definition uses a predefined action called view, the action for viewing particular content. It is also browsable and uses a scheme of geoname so that when a Uri starts with geoname://, the activity with this intent filter launches.You can read more about this particular intent filter in Chapter 14, "Using Location-Based Services (LBS) APIs."

You can define custom actions unique to your application. If you do so, be sure to document these actions if you want them to be used by third parties.

Easy Software Profits

Easy Software Profits

Here's How Anyone Can Start, Build and Run their Own Successful Software Empire Without Knowing the First Thing About Programming, Scripting Or Any 'Coder' Stuff. There is no doubt about it software sells. Software has a high percieved value and it solves problems for people.  A claim that can't always be made for PDF books, Video products and the like.

Get My Free Ebook


Post a comment