What is Android Manifest file?

What is Android Manifest file?

About Android Manifest file

The Android Manifest file describes the essential information about your app to the Android build tools, the Android operating system, and Google Play.

The Android Manifest is an XML file that contains important metadata about the Android app. This includes the package name, activity names, main activity (the entry point to the app), Android version support, hardware features support, permissions, and other configurations

The Android Manifest is responsible to protect the application to access any protected parts by providing the permissions

The Android Manifest also declares the android API that the application is going to use

The hardware and software feature the app requires, which affects which devices can install the app from Google Play are also declared inside the Android Manifest file.

The Android Manifest is the required XML file for all android applications and is located inside the root directory

A simple Android Manifest file looks like this:

image.png

Elements of the Manifest file

Elements of the Manifest file are -

  1. <manifest>
  2. <application>
  3. <activity>
  4. <intent-filter>
  5. <action>
  6. <category>

<manifest> element is the root element of the AndroidManifest.xml file It has a package attribute that describes the package name of the activity class.

<application> is the subelement of the manifest. It includes the namespace declaration. This element contains several subelements that declare the application component such as activity etc

Commonly used attributes of the <application> tag are:

  • android:icon represents icon for the app
  • android:label works as the app name
  • android:theme represents a common theme for all android activities.

<activity> is the subelement of the application and represents an activity that must be defined in the AndroidManifest.xml file. It has many attributes such as label, name, theme, launchMode, etc

Attributes of <activity> tag are:

  • android:label represents a label i.e. displayed on the screen.
  • android:name represents a name for the activity class. It is a required attribute

<intent-filter> is the sub-element of activity that describes the type of intent to which activity, service, or broadcast receiver can respond to

<action> adds an action for the intent-filter. The intent-filter must have at least one action element

<category> adds a category name to an intent-filter

Some extra information

The <uses-feature> element allows you to declare hardware and software features your app needs

To indicate the minimum version with which your app is compatible, your manifest must include the <uses-sdk> tag and its minSdkVersion attribute. Note that the attributes in the <uses-sdk> element are overridden by corresponding properties in the build.gradle file.

To learn more about the Android Manifest file. Refer to the following documentation https://developer.android.com/guide/topics/manifest/manifest-intro

This is the end of the article. Glad you liked.