What is Android Manifest File?
Welcome to another great informative tutorial from our Android development course. Whenever you launch a new project, Android automatically generates some files. One of these files is called Android Manifest. This file consists of all the information about your application. It’s a must have file for every application. This file is run before your application is started. It’s like a summary of your application.
Where is Android Manifest File Located in Android Studio?
To locate the Android Manifest File, go to App/Manifest/AndroidManifest.xml. As seen here
Use of Android Manifest
- It names the java packages for an Android Application.
- It declares the permission which your application will required. For Example, does your app requires internet connection or it need to access the memory card etc.?
- It will save the minimum level of API required for your Android Application.
- Android Manifest File must have all the component of your application declare in it. Like Activities, Services, Broadcasts etc.
A complete List of Elements included in Android Manifest file:
- <action>: Add Action to intent filter.
- <activity>: It declare the activity. For example, our main activity.
- <activity-alias>:An alias for the activity.
- <application> : It declares the application. It is present only once in the entire file.
- <category> :Adds a category name to your application.
- <data> :Add a specific data to your application.
- <grant-uri-permission>: A permission to grant data-subset for provider
- <instrumentation> :Help monitoring application interaction with the system.
- <intent-filter>: It shows the type of intents an activity, service or broadcast can respond to.
- <manifest> : Beginner tag for AndroidManifest.xml. It is present only once in the entire file.
- <meta-data>: Additional information about parent component.
- <permission>: Declares a security permission
- <permission-group>: Helps in logically grouping of permissions
- <permission-tree>: Declare the name for permission tree.
- <provider>: Declare a content provider
- <receiver>: Declare a broadcast receiver
- <service>: Declares a Service.
- <supports-screens> :Shows information about screens
- <uses-configuration>: Indicates the hardware or software. For example, your application requires a mouse to be used. Your application will not install in those devices that don’t have a mouse
- <uses-feature> :Declares the hardware or software feature that is required by your application.
- <uses-library>: Shows the libraries being used
- <uses-permission> :Declare the user permissions.
- <uses-sdk> :Shows the minimum and targeted SDK versions for your Android Application
You can click on each item to learn more about it in detail. We will learn about these as our course progresses in future.
Sample code from our hello world application.
</code><pre></pre> <pre><?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.pizza.app.myapplication"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> </pre><code>
I hope you got the basic idea about Android Manifest.xml. If you have any queries do mention in the comment section below. Check out What is Gradle in Android Studio.