Sunday, 22 March 2020

Importance of Android manifest file

Every project in Android includes AndroidManifest.xml, file which is stored in the root directory of its project hierarchy. The manifest file is an important part of our application because it defines the structure and metadata of our application, its components, and its requirements.
This file includes nodes for each of the Activities, Services, Content Providers and Broadcast Receiver that make the application and it also includes  Intent Filters and Permissions, which determines how activities co-ordinate with each other and other applications.
The manifest file also specifies the application metadata, which includes its icon, version number, themes etc.
A  manifest node looks like:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pkg.myapp"
android:versionCode="1"
android:versionName="0.9 Beta"
[....manifest nodes....] 
</manifest> 
uses-sdk– It is used to define a minimum and maximum SDK version that must be available on a device so that our application function properly, and target SDK for which it has been designed .


<uses-sdk android:minSdkVersion=”6”
        android:targetSdkVersion=”15”/>

application– A manifest can contain only one application node. It uses attributes to specify the metadata for your application (including its title, icon and theme). During development we should include a debuggable attribute set to true to enable debugging, then be sure to disable it for your release builds.

<application android:icon="@drawable/icon"
             android:theme="@android:style/Theme.Light"
             android:name=".MyApplicationClass"
             android:debuggable="true">
             [....application nodes.....]

</application>

No comments:

Post a Comment