- Mindroid applications are composed of one or more services
- Each service performs a different role in the overall application behavior, and each one can be activated individually by other services
- The manifest file must declare all services in the application and should also declare all application requirements
In this document
Mindroid applications are written in the Java programming language using the Java language specification v1.4.
The Mindroid SDK tools compile the code into an Mindroid package, an
archive file with an
.jar suffix. All the code in a single
.jar file is considered
to be one application and is the file that Mindroid use to install the
Application components are the essential building blocks of an Mindorid application.
There is currenlty only one type of application component, the service.
- A service is a component that runs in the background to perform long-running operations or to perform work for remote lightweight processes.
Services are activated by an asynchronous message called an intent. Intents bind individual components to each other at runtime (you can think of them as the messengers that request an action from other components), whether the component belongs to your application or another.
An intent is created with an
Intent object, which defines a message to
activate a specific component.
There are separate methods for activating a service:
- You can start a service (or give new instructions to an ongoing service) by
- Or you can bind to the service by passing an
The Manifest File
Before the Mindroid system can start an application component, the system must know that the
component exists by reading the application's
MindroidManifest.xml file (the "manifest"
file). Your application must declare all its components in this file, which must be at the root of
the application project directory.
The primary task of the manifest is to inform the system about the application's components. For example, a manifest file can declare a service as follows:
<?xml version="1.0" encoding="utf-8"?> <manifest ... > <application ... > <service mindroid:name="com.example.project.ExampleService" mindroid:autostart="true" ... > </service> ... </application> </manifest>
You must declare all application components this way:
<service>elements for services
Servies that you include in your source but do not declare in the manifest are not visible to the system and, consequently, can never run.
For more about how to structure the manifest file for your application, see the The MindroidManifest.xml File documentation.