Describe AndroidManifest File in Details 5 Mark



AndroidManifest.xml
Manifest file for an android application is a resource file which contains all the details needed by the android system about the application. It is a key file that works as a bridge between the android developer and the android platform. It helps the developer to pass on functionality and requirements of our application to Android. This is an xml file which must be named as AndroidManifest.xml and placed at application root. Every Android app must have AndroidManifest.xml file. AndroidManifest.xml allows us to define,
The packages, API, libraries needed for the application.
  • Basic building blocks of application like activities, services and etc.
  • Details about permissions.
  • Set of classes needed before launch.
Elements of AndroidManifest.xml
Following are the elements(listed alphabetically) that can appear in AndroidManifest.xml, this list is restricted and we cannot add our own elements to it.
<action><activity><activity-alias><application><category><data><grant-uri-permission><instrumentation><intent-filter><manifest><meta-data><permission><permission-group><permission-tree><provider><receiver><service><supports-screens><uses-configuration><uses-feature><uses-library><uses-permission><uses-sdk>
Elements for Application Properties
  • uses-permission – used to specify permissions that are requested for the purpose of security.
  • permission – used to set permissions to provide access control for some specific component of the application.
  • permission-group – does the same as above for a set of components.
  • permission-tree – refer one specific name of the component which is the owner or parent of the set of component.
  • instrumentation – enables to know interaction between Android system and application.
  • uses-sdk – specifies the platform compatibility of the application.
  • uses-configuration – specifies set of hardware and software requirement of the application.
  • uses-feature – specifies single hardware and software requirement and their related entity.
  • supports-screens, compatible-screens – both these tags deals with screen configuration mode and size of the screen and etc.
  • supports-gl-texture – specifies texture based on which the application is filtered.
Elements for Application Components
These should be enclosed in <application> container.
  • activity – has the set of attributes based on user interface.
  • activity-alias – specifies target activities.
  • service – has the operation provided by any library or API, running in background that is not visible.
  • receiver – that makes to receive message broadcasted by the same application or by outside entity.
  • provider – provides some structure to access application data.
  • uses-library – it specifies set of library files need to run the application.
These entire information has to be known by the system to run any file of the application. So that this file has to be created at the time of installing and not at the time of running the application.
If this is the second tutorial after Hello World, you may not be able to understand every element listed. Don’t worry, I just wanted to give an overview. As we progress we will understand about each of these in detail.
Structure of AndroidManifest.xml
<manifest>
<Elements for Application properties should come here - refer above for list>
<application>
<Elements for application components should come here - refere above for list>
</application></manifest>


Sample AndroidManifest.xml
Following is a sample Android manifest file that was created as part of a android hello world application.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.javapapers.android"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk android:minSdkVersion="7" />
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:label="@string/app_name"
            android:name=".HelloWorld" >
            <intent-filter >
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application></manifest>
  • AndroidManifest.xml must be the file named and it should be placed in root folder of application.
  • and elements must be present in the file and is allowed only once.
  • Elements that are present inside has no specific order forced.

No comments:

Post a Comment

Featured post

Ror