Learning Resources
		 
Android manifest XML
Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory. The manifest presents essential information about the application to the Android system, information the system must have before it can run any of the application's code. Among other things, the manifest does the following:
- It names the Java package for the application. The package name serves as a unique identifier for the application.
- 
		It describes the components of the application — the activities, services, broadcast receivers, and content providers that the application is composed of. It names the classes that implement each of the components and publishes their capabilities (for example, which Intentmessages they can handle). These declarations let the Android system know what the components are and under what conditions they can be launched.
- It determines which processes will host application components.
- It declares which permissions the application must have in order to access protected parts of the API and interact with other applications.
- It also declares the permissions that others are required to have in order to interact with the application's components.
- 
		It lists the Instrumentationclasses that provide profiling and other information as the application is running. These declarations are present in the manifest only while the application is being developed and tested; they're removed before the application is published.
- It declares the minimum level of the Android API that the application requires.
- It lists the libraries that the application must be linked against.
Structure of the Manifest File
The diagram below shows the general structure of the manifest file and every element that it can contain. Each element, along with all of its attributes, is documented in full in a separate file. To view detailed information about any element, click on the element name in the diagram, in the alphabetical list of elements that follows the diagram, or on any other mention of the element name.
xml version="1.0" encoding="utf-8"?>/> /> /> /> /> /> /> /> /> /> /> /> /> />/> . . . /> . . . . . . /> /> /> /> 
All the elements that can appear in the manifest file are listed below in alphabetical order. These are the only legal elements; you cannot add your own elements or attributes.
File Conventions
Some conventions and rules apply generally to all elements and attributes in the manifest:
- Elements
- 
		Only the If an element contains anything at all, it contains other elements. All values are set through attributes, not as character data within an element. Elements at the same level are generally not ordered. For example, - Attributes
- 
		In a formal sense, all attributes are optional. However, there are some that must be specified for an element to accomplish its purpose. Use the documentation as a guide. For truly optional attributes, it mentions a default value or states what happens in the absence of a specification.
		Except for some attributes of the root android:prefix — for example,android:alwaysRetainTaskState. Because the prefix is universal, the documentation generally omits it when referring to attributes by name.
- Declaring class names
- 
		Many elements correspond to Java objects, including elements for the application itself (the If you define a subclass, as you almost always would for the component classes ( Activity,Service,BroadcastReceiver, andContentProvider), the subclass is declared through anameattribute. The name must include the full package designation. For example, anServicesubclass might be declared as follows:. . . > . . . > android:name="com.example.project.SecretService" . . . > . . . . . .However, as a shorthand, if the first character of the string is a period, the string is appended to the application's package name (as specified by the packageattribute). The following assignment is the same as the one above:package="com.example.project" . . . > . . . > android:name=".SecretService" . . . > . . . . . .When starting a component, Android creates an instance of the named subclass. If a subclass isn't specified, it creates an instance of the base class. 
- Multiple values
- 
		If more than one value can be specified, the element is almost always repeated, rather than listing multiple values within a single element. For example, an intent filter can list several actions:
		. . . > android:name="android.intent.action.EDIT" /> android:name="android.intent.action.INSERT" /> android:name="android.intent.action.DELETE" /> . . . 
- Resource values
- 
		Some attributes have values that can be displayed to users — for example, a label and an icon for an activity. The values of these attributes should be localized and therefore set from a resource or theme. Resource values are expressed in the following format,
		@[package:]type:namewhere the package name can be omitted if the resource is in the same package as the application, type is a type of resource — such as "string" or "drawable" — and name is the name that identifies the specific resource. For example: android:icon="@drawable/smallPic" . . . > Values from a theme are expressed in a similar manner, but with an initial ' ?' rather than '@':?[package:]type:name
- String values
- 
		Where an attribute value is a string, double backslashes ('\\') must be used to escape characters — for example, '\\n' for a newline or '\\uxxxx' for a Unicode character.
File Features
The following sections describe how some Android features are reflected in the manifest file.
Intent Filters
The core components of an application (its activities, services, and broadcast receivers) are activated by intents. An intent is a bundle of information (an Intentobject) describing a desired action — including the data to be acted upon, the category of component that should perform the action, and other pertinent instructions. Android locates an appropriate component to respond to the intent, launches a new instance of the component if one is needed, and passes it the Intent object.
Components advertise their capabilities — the kinds of intents they can respond to — through intent filters. Since the Android system must learn which intents a component can handle before it launches the component, intent filters are specified in the manifest as 
An intent that explicitly names a target component will activate that component; the filter doesn't play a role. But an intent that doesn't specify a target by name can activate a component only if it can pass through one of the component's filters.
For information on how Intent objects are tested against intent filters, see a separate document, Intents and Intent Filters.
Icons and Labels
A number of elements have iconand labelattributes for a small icon and a text label that can be displayed to users. Some also have a descriptionattribute for longer explanatory text that can also be shown on-screen. For example, the 
In every case, the icon and label set in a containing element become the default iconand labelsettings for all of the container's subelements. Thus, the icon and label set in the 
The icon and label set for an intent filter are used to represent a component whenever the component is presented to the user as fulfilling the function advertised by the filter. For example, a filter with "android.intent.action.MAIN" and "android.intent.category.LAUNCHER" settings advertises an activity as one that initiates an application — that is, as one that should be displayed in the application launcher. The icon and label set in the filter are therefore the ones displayed in the launcher.
Permissions
A permission is a restriction limiting access to a part of the code or to data on the device. The limitation is imposed to protect critical data and code that could be misused to distort or damage the user experience.
Each permission is identified by a unique label. Often the label indicates the action that's restricted. For example, here are some permissions defined by Android:
A feature can be protected by at most one permission.
If an application needs access to a feature protected by a permission, it must declare that it requires that permission with a 
An application can also protect its own components (activities, services, broadcast receivers, and content providers) with permissions. It can employ any of the permissions defined by Android (listed in android.Manifest.permission) or declared by other applications. Or it can define its own. A new permission is declared with the 
 . . . >
     android:name="com.example.project.DEBIT_ACCT" . . . />
     android:name="com.example.project.DEBIT_ACCT" />
    . . .
     . . .>
         android:name="com.example.project.FreneticActivity"
                  android:permission="com.example.project.DEBIT_ACCT"
                  . . . >
            . . .
         
     
   
Note that, in this example, the DEBIT_ACCTpermission is not only declared with the 
If, in the same example, the permissionattribute was set to a permission declared elsewhere (such as android.permission.CALL_EMERGENCY_NUMBERS, it would not have been necessary to declare it again with a 
The permissionGroupattribute.
Libraries
Every application is linked against the default Android library, which includes the basic packages for building applications (with common classes such as Activity, Service, Intent, View, Button, Application, ContentProvider, and so on).
However, some packages reside in their own libraries. If your application uses code from any of these packages, it must explicitly asked to be linked against them. The manifest must contain a separate 

