The AndroidManifest.xml file contains information about your package, including applications such as activities, services, broadcast receivers, content providers, etc.
It performs some other tasks also:
- It is responsible to protect the application to access any protected parts by providing the permissions.
- It also declares the android api that the application is going to use.
- It lists the instrumentation classes. The instrumentation classes provides profiling and other informations. These informations are removed just before the application is published etc.
This is the required XML file for all Android applications and is located inside the root directory.
A simple AndroidManifest.xml file looks like this:
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Elements of the AndroidManifest.xml file
The elements used in the above xml file are described below.
The manifest is the fundamental element of the AndroidManifest.xml file. There is a package feature that describes the package name of the activity class.
The application is a sub-section of the manifest. This includes namespace declaration. This element contains several sub-committees, which declares application component such as activity etc.
Typically used features include icons, labels, themes etc.
- The Android:- icon represents the icon for all Android application components.
- The Android-label works as the default label for all application components.
- The Android- theme represents a general theme for all Android activities.
Activity is a sub-section of the application and represents an activity that should be defined in the Android manifest.exml file. It has many features like label, name, theme, launch mode etc.
Android: The label represents a label that is displayed on the screen.
Android: Name represents a name for the activity class, this feature is required
Intent-filter is the sub-element of the activity, which can respond to what activity, service or broadcast receiver, describes this type of intent
It adds an action to intent-filters, intent-filters should have at least one action element.
It adds a category name for an intention-filter