Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Structure of Android Manifest file

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 255
    Comment on it

    In every android application AndroidManifest.xml is the necessary part. Manifest file contains every essential information about your appliucation. It contains information about your package, activities, permissions, services, brodcast receiver and content providers. The common structure of android manifest file is given below.

    <?xml version="1.0" encoding="utf-8"?>
    
    <manifest>                    
    
        <uses-permission />
        <permission />
        <permission-tree />
        <permission-group />
        <instrumentation />
        <uses-sdk />
        <uses-configuration />  
        <uses-feature />  
        <supports-screens />  
        <compatible-screens />  
        <supports-gl-texture />  
    
        <application>
    
            <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:- A simple AndroidManifest.xml file looks like this:-

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"          // describes the package name of aplication and it is a root directory
        package="com.example.android.basiccontactables"
        android:versionCode="1"
        android:versionName="1.0" >
    
        <uses-permission android:name="android.permission.READ_CONTACTS"/>        // security permission to limit access to specific components or features 
        <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
        <permission android:name="android"></permission>
        <uses-feature android:name="android.hardware.camera" />                   // use to inform hardware and software dependencies
        <supports-screens                                                         // to specify the screen sizes your application supports
            android:resizeable="true"
            android:smallScreens="true" 
            android:largeScreens="true"
            android:xlargeScreens="true"  
            android:normalScreens="true" 
            android:anyDensity="true"/>                                 
    
        <application                                                              // includes namespace declaration 
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"                                  // represents the icon of the app
            android:label="@string/app_name"                                      // default label for application components
            android:theme="@style/Theme.Sample" >                                 // represents theme for activities
            <activity                                                             // represents an activity
                android:name="com.example.android.basiccontactables.MainActivity"
                android:label="@string/app_name"
                android:launchMode="singleTop">
                <meta-data
                    android:name="android.app.searchable"
                    android:resource="@xml/searchable" />
                <intent-filter>                                                   // describes the type of intent
                    <action android:name="android.intent.action.SEARCH" />        // adds action to the intent filter
                </intent-filter>
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />  // adds category name to the intent filter
                </intent-filter>
            </activity>
        <receiver android:name="MyScheduleReceiver" >                             // receives messages by application or by outside, like broadcast receiver or BOOT_COMPLETED etc
                <intent-filter>
                    <action android:name="android.intent.action.BOOT_COMPLETED" />
                </intent-filter>
            </receiver>
            <receiver android:name="MyStartServiceReceiver" >
            </receiver>
        <service android:enabled="true" android:name=".services.Communication" /> // To perform operations on background 
         <provider                                                                // To share data between different applications content provider is very much useful
                android:name=".MyProvider"
                android:authorities="com.example.android.basiccontactables.MyProvider"
                android:exported="true"
                android:multiprocess="true" >
            </provider>
        </application>
    </manifest>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: