The core components of an application — services — are activated through messages,
Intent messaging is a facility for late run-time binding between components in the same
or different applications. The intent itself, an
object, is a passive data structure holding an abstract description of an operation
to be performed.
An Intent object is passed to
to initiate a service or deliver new instructions to an ongoing service. Similarly, an intent can be passed to
to establish a connection between the calling component and a target service. It can optionally initiate the service if it's not already running.
The Mindroid system finds the appropriate service to respond to the intent, instantiating it if necessary.
This document begins with a description of Intent objects. It then describes the rules Mindroid uses to map intents to components — how it resolves which component should receive an intent message.
Intent object is a bundle of information. It
contains information of interest to the component that receives the intent
(such as actions to be taken and the data to act on) plus information
of interest to the Mindroid system.
Principally, it can contain the following:
- Component name
- The name of the component that should handle the intent. This field is
ComponentNameobject — a combination of the fully qualified class name of the target component (for example "
com.example.project.ExampleService") and the package name set in the manifest file of the application where the component resides (for example, "
The component name is mandatory. The Intent object is delivered to an instance of the designated class.
- Key-value pairs for additional information that should be delivered to the
component handling the intent.
The Intent object has a series of
put...()methods for inserting various types of extra data and a similar set of
get...()methods for reading the data. These methods parallel those for
Bundleobjects. In fact, the extras can be installed and read as a Bundle using the
- Flags are currently not used.
- Explicit intents designate the target component by its name (the component name field, mentioned earlier, has a value set).
Mindroid delivers an explicit intent to an instance of the designated target class. Nothing in the Intent object other than the component name matters for determining which component should get the intent.