Intent

An Intent is a messaging object you can use to request an action from another app component. There are three fundamental use cases:
  • Starting an activity
  • Starting a service
  • Delivering a broadcast

Types of intents

There are two types of intents:
  • Explicit intents specify which application will satisfy the intent, by supplying either the target app's package name or a fully-qualified component class name. You'll typically use an explicit intent to start a component in your own app, because you know the class name of the activity or service you want to start. 
  • Implicit intents do not name a specific component, but instead declare a general action to perform, which allows a component from another app to handle it.

Intent content

The primary information contained in an Intent is the following:
  • Component name : The name of the component to start. This is optional, but it's the critical piece of information that makes an intent explicit, meaning that the intent should be delivered only to the app component defined by the component name. Without a component name, the intent is implicit and the system decides which component should receive the intent based on the other intent information (such as the action, data, and category—described below).
  • Action: A string that specifies the generic action to perform. You can specify your own actions for use by intents within your app (or for use by other apps to invoke components in your app), but you usually specify action constants defined by the Intent class or other framework classes.
  • Data: The URI (a Uri object) that references the data to be acted on and/or the MIME type of that data.
  • Category: A string containing additional information about the kind of component that should handle the intent. Any number of category descriptions can be placed in an intent, but most intents do not require a category.
  • Extras: Key-value pairs that carry additional information required to accomplish the requested action. Just as some actions use particular kinds of data URIs, some actions also use particular extras.You can add extra data with various putExtra() methods, each accepting two parameters: the key name and the value. You can also create a Bundle object with all the extra data, then insert the Bundle in the Intent with putExtras().
  • Flags: are defined in the Intent class that function as metadata for the intent. The flags may instruct the Android system how to launch an activity and how to treat it after it's launched.

Intent Filter

When you use an implicit intent, the Android system finds the appropriate component to start by comparing the contents of the intent to the intent filters declared in the manifest file of other apps on the device. If the intent matches an intent filter, the system starts that component and delivers it the Intent object. If multiple intent filters are compatible, the system displays a dialog so the user can pick which app to use.

An intent filter is an expression in an app's manifest file that specifies the type of intents that the component would like to receive, based on the intent's action, data, and category. For instance, by declaring an intent filter for an activity, you make it possible for other apps to directly start your activity with a certain kind of intent. Likewise, if you do not declare any intent filters for an activity, then it can be started only with an explicit intent.

Each intent filter is defined by an <intent-filter> element in the app's manifest file, nested in the corresponding app component (such as an <activity> element). Inside the <intent-filter>, you can specify the type of intents to accept using one or more of these three elements:
  • <action> : Declares the intent action accepted, in the name attribute. The value must be the literal string value of an action, not the class constant.
  • <data>: Declares the type of data accepted, using one or more attributes that specify various aspects of the data URI (scheme, host, port, path) and MIME type.
  • <category>: Declares the intent category accepted, in the name attribute. The value must be the literal string value of an action, not the class constant.

Pending Intent

A PendingIntent object is a wrapper around an Intent object. The primary purpose of a PendingIntent is to grant permission to a foreign application to use the contained Intent as if it were executed from your app's own process. By giving a PendingIntent to another application, you are granting it the right to perform the operation you have specified as if the other application was yourself (with the same permissions and identity).

Major use cases for a pending intent include the following:
  • Declaring an intent to be executed when the user performs an action with your Notification (the Android system's NotificationManager executes the Intent).
  • Declaring an intent to be executed when the user performs an action with your App Widget (the Home screen app executes the Intent).
  • Declaring an intent to be executed at a specified future time (the Android system's AlarmManager executes the Intent).
Source: Intents and Intent Filters | Android Developers