In this blog post we would try and understand the basics of Application Manifest in the Android system.
The simplest of any Android application has the following components:
- Resources classified in the resource folder (res).
- Some auto generated code like R.java.
- ApplicationManifest.xml file.
This blog post will deal with the third component – Application manifest file.
Application Manifest is an xml file every Android application contains with the name ApplicationMainifest.xml in the root directory of the application.
- The file is generated automatically on finish of wizard for android project creation.
- File gives all the information pertaining to the successful execution of all the functionalities present in the application to the android system.
- It is like a blue print of the application components or what you can call a make file in C++ projects like Qt, Objective C in IPhone.
Sample example:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.sampleApp" android:versionCode="1" android:versionName="1.0"> - (1) <application android:icon="@drawable/icon" android:label="@string/app_name" android:permission="android.permission.BLUETOOTH"> - (2) <activity android:name=".SampleActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> - (3) </application> <uses-sdk android:minSdkVersion="9" /> - (4) <permission android:name="com.android.myPermission" android:icon="@drawable/icon" android:label="My Permission" android:protectionLevel="dangerous" android:permissionGroup="com.android.SamplePermission" android:description="@string/some_description"></permission> </manifest>
Versioning:
Refer line (1) in the code above.
<manifest> tag consists of application versioning information (android:versionCode and android:versionName) helps the android systems to maintain the upgrade/ downgrade of application.
Android system uses versionCode for understanding the upgrade of the application on the device and versionName is used only for the user notification purpose. versionName is displayed for the user to notify that a newer version of the application is available in the market.
Activity:
Refer line (3) in the code above.
Android application consists of four types of components:
- Service – Non-visual component always running in background to perform long operations.
- Content providers – It’s a data storage system eg: File storage systems and SQLite. Content providers provide a standard interface that helps in application doing standard operations on database system. E.g. address book, messages, emails etc.
- Broadcast receivers – status messages / events / error handling etc. for an example error messages,
- Activity – Activity are screens that user interacts with while using the application, it may be a form collecting keyboard inputs, clicks etc. It is same as a form is to a web application.
Activities need to be register for an application in the Manifest file for Android systems to include them in the run environment. An application may consist of one or more activities; there can be multiple activity tags in the application which may interact with each other.
<intent-filter> – Intent filters control which actions of android, user driven or application driven is going to launch the application. Activities can contains multiple intent filters. Contains:
- <action> as MAIN (android:name=”android.intent.action.MAIN”) means that this activity is the entry point for the application. This activity will be the top level screen (Home screen) in the application.
- The manifest xml above show case how you can place your activity on the android home screen launcher. For that you have to put a <category> with Launcher (android:name=”android.intent.category.LAUNCHER”) telling the system that this activity should be top-level LAUNCHER.
Permission:
Refer line (2) in the code above.
Android OS model requires applications to highlight what features of OS or resources they are going to use. Take an example of an application that is going to make use of the Bluetooth for transfer of files or need internet access for connection to facebook, twitter etc.
Hence, this tag provides the information related to the access rights to the specific components or features of the application from the very same application or other applications. By default android applications do not have any permission to intervene the device data or components.
This can be provided either in <application> tag or <uses-permission>
For example:
- Permissions to access BLUETOOTH of device is: <application android:permission=”android.permission.BLUETOOTH” />
- To Receive SMS: <uses-permission android:name=”android.permission.RECEIVE_SMS” />
User can define their set of permissions under <permissions> tag.
SDK Version:
Refer line (4) in the code above.
Application which makes use of specific features like 3D transitions available in higher version Android SDK say 3.0 will not work on the devices having lower version say 2.3. Hence manifest file provides the information to the system while installation; checking for the availability of SDK version and install accordingly.
<manifest> tag holds <uses-sdk> containing minimum API level integer (android:minSdkVersion) which helps the Android system to allow/disallow installation of the application depending upon the system’s API level.
Eg: For minSdkVersion = 9 minimum system’s API level is Android 2.3.3 SDK.
For detailed information on Manifest refer: Application Manifest









