Thursday, December 26, 2013

AndroidManifest.xml file in android / AndroidMenifest file

Every app must have AndroidManifest.xml file in its root directory.
It has information about the application which is accessed by OS before running the app.
It has following things:-
1.package name, Its unique per application.
2.Describe the components of the application.(4 main components of apps:- activity, services, broadcast receiver , content provider) It names the classes that implement each of the components and publishes their capabilities.
3.declaration of permission.
4.Minimum level of Android app.
5.List of libraries that must be linked

Template of AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>

<manifest> //it must be there and only once

    <uses-permission />
    <permission />
    <permission-tree />
    <permission-group />
    <instrumentation />
    <uses-sdk />
    <uses-configuration /> 
    <uses-feature /> 
    <supports-screens /> 
    <compatible-screens /> 
    <supports-gl-texture /> 

    <application> //it must be there and only once

        <activity>
            <intent-filter>
                <action />
                <category />
                <data />
            </intent-filter>
            <meta-data />
        </activity>

        <activity-alias>
            <intent-filter> . . . </intent-filter>
            <meta-data />
        </activity-alias>

        <service>
            <intent-filter> . . . </intent-filter>
            <meta-data/>
        </service>

        <receiver>
            <intent-filter> . . . </intent-filter>
            <meta-data />
        </receiver>

        <provider>
            <grant-uri-permission />
            <meta-data />
            <path-permission />
        </provider>

        <uses-library />

    </application>

</manifest>

Example
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.shriram.timetone"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />
        <uses-permission android:name="android.permission.INTERNET" />
   

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.shriram.timetone.MainActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Black.NoTitleBar" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>







No comments:

Post a Comment