A very simple AndroidManifest.xml looks like this:

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="" package=""> <application android:icon="@drawable/icon"> <activity android:name=".Hello_Android"



<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />

</intent-filter> </activity>

</application> </manifest>

• Almost every AndroidManifest.xml (as well as many other Android XML files) will include the namespace declaration


in its first element. This makes a variety of standard Android attributes available in the file, which will be used to supply most of the data for elements in that file.

• Almost every manifest includes a single <application> tag, which itself contains several tags describing Applications, IntentReceivers, etc. that are available in this application.

• If you want to make an Activity launchable directly through the user, you will need to make it support the MAIN action and LAUNCHER category, what result as shown here:

Picture 5 Directly launchable Activity

What follows is a detailed list of the structure of an AndroidManifest file, describing all available <tags>, with an Example for each:


This is the root node of each AndroisManifest.xml. It contains the package-attribute, which points to any package in out Activity. Other Activities-path will base relative to its value.

<manifest xmlns:android=""



Describes a security permission, which your package must be granted in order for it to operate correctly (i.e. when you want to send SMS or use the Phone-Contacts). The permissions get granted by the user during installation of your application. Quantity: 0+

<uses-permission android:name=" android.permission.RECEIVE_SMS"/>


Declares a security permission that can be used to restrict which applications can access components or features in your (or another) package. Quantity: 0+


Declares the code of an instrumentation component that is available to test the functionality of this or another package. See Instrumentation for more details. Quantity: 0+


Root element containing declarations of the application-level components contained in the package. This element can also include global and/or default attributes for the application, such as a label, icon, theme, required permission, etc. Quantity: 0 or 1.

<application android:icon="@drawable/icon">

You can place 0+of each of the following children: <activity>

An Activity is the primary thing for an application to interact with the user. The initial screen the user sees when launching an application is an activity, and most other screens they use will be implemented as separate activities declared with additional activity tags.

<activity android:name=".Welcome" android:label="@string/app_name">

# Note: Every Activity must have an <activity> tag in the manifest whether it is exposed to the world or intended for use only within its own package. If an Activity has no matching tag in the manifest, you won't be able to launch it.

Optionally, to support late runtime lookup, you can include 1+ <intent-filter> elements to describe the actions the activity supports.


Declares what kind of Intents a component supports. In addition to the various kinds of values that can be specified under this element, attributes can be given here to supply a unique label, icon, and other information for the action being described.



An action-type that the component supports. Example:

<action android:name="android.intent.action.MAIN" />


A category-type that the component supports. Example:

<category android:name="android.intent.category.LAUNCHER" />

An MIME type, URI scheme, URI authority, or URI path that the component supports.

You can also associate 1+ pieces of metadata with your activity:


Adds a new piece of meta data to the activity, which clients can retrieve through



An IntentReceiver allows an application to be told about changes to data or actions that happen, even if it is not currently running. As with the activity tag, you can optionally include 1+ <intent-filter> elements that the receiver supports or <meta-data> values, just all the same as with <activity>.

<receiver android:name=".SMSReceiver">


A Service is a component that can run in the background for an arbitrary amount of time. As with the activity tag, you can optionally include one or more <intent-filter> elements that the service supports or <meta-data> values; see the activity's <intent-filter> and <meta-data> descriptions for more information.


A ContentProvider is a component that manages persistent data and publishes it for access by other applications. You can also optionally attach one or more <meta-data> values, as described in the activity's <meta-data> description.

Of course all <tags> have to be </closed> or closed <directly/>.

0 0

Post a comment