In Android, Intents are asynchronous messages which allow application components to request functionality from other Android components. Intents allow you to interact with components from the same applications as well as with components contributed by other applications. For example, an activity can start an external activity for taking a picture from camera.

An intent can contain data via a Bundle. This data can be used by the receiving component.

A Little about Tasks in Android

An application can access other Android components to achieve a task. For example, from a component of your application you can trigger another component in the Android system, which manages pictures, even if this component is not part of your application.


In Android the reuse of other application components is a concept known as task.


type_of_intent

Determining Component Available for Intent

For example, you want to check if a certain intent receiver is available and in case a component is available, you enable a functionality in your application.

This check can be done via the PackageManager class.

The following example code checks if a component has registered for a certain intent. Construct your intent as you are desired to trigger it and pass it to the following method.



public static boolean isIntentAvailable(Context ctx, Intent intent) {
final PackageManager mgr = ctx.getPackageManager();
List list = mgr.queryIntentActivities(intent,PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
}


Based on the result you can adjust your application. For example, you could disable or hide certain menu items.