Saturday, 21 July 2012

Introduction of Android Manifeast File


Introduction of Android Manifeast File


Android manifest file control whole application. This file defines all primary task related to activity, services, permission to access android resources, android sdk version for application.

Example of Android Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.programmingduniya"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".Language"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
    <uses-sdk android:minSdkVersion="10" />
    <uses-permission android:name="ACCESS_NETWORK_STATE">      
</manifest> 
Manifest tag in android manifest file define following attribute.
  1. package : android package attribute define java file directory or library. This attribute always unique for each application. For this purpose android use domain reverse name methodology. This way avoid conflict with other android apps library.
  2. versionCode : android version code define sequence of our app. This is Integer value and must start with 1 for first time. This attribute helps android system to detect any update in application.
  3. VersionName : android version name useful for users. This is String value. This is display to user to read version name of application.
Android use application tag to start our application. This tag has following sub tag.
  1. activity : This define android java class name. for this purpose we use android:name attribute. In this attribute we define our activity with dot.
  2. intent-filter : This tag is used for main activity of application. this define two sub tags
    • action : It is used for main activity. for this purposse we need to use "android.intent.action.MAIN" value.
    • category : This is used to add main activity to android application directory. for this purpose we need to use "android.intent.category.LAUNCHER" value.
  3. service : for starting service we use this tag.
uses-sdk tag in android manifest file define minimum android device version where application runs.
uses-permission tag in android manifest define permission for accessing various android resource.

No comments:

Post a Comment