keywords:
Bookmark and Share



Front Back
AndroidManifest.xml
The Android system uses the info in this file to do the following:



  • Install and upgrade the application package

  • Display application details to users

  • Launch application activities

  • Manage application permissions

  • Handle a number of other advanced application configurations, including acting as a service provider or content provider


< manifest > tag
Used to define the package and is the main tag for the manifest file. This contains the package, version code and version name.

E.g. - < manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidbooks.droid1"
android:versionCode="1"
android:versionName="1.0" >
< uses-library > tag
Link secondary libraries using this tag

E.g. - < uses-library android:name="com.company.sharedutilities" />
Application Versioning
Version information is used for:
  • To organize and keep track of application features
  • To manage application upgrades

Version name and version code are set within the < manifest > tag.
Version Name
Used to keep track of application builds. This is essential when publishing and supporting applications.
Version Code
Allows the Android platform to programmatically upgrade or downgrade an application. This should be incremented for published application or testing purposes only.
< uses-sdk > tag
Used to specify the minimum SDK required on the handset in order for the application to run properly.

E.g. - < uses-sdk android:minSdkVersion="7" />
< application > tag - label
A string that represents the application name. You can set the name to a fixed string or a string resource.

E.g. - < application android:label="My application name" / >
or
< application android:label="@string/app_name" / >
< application > tag - icon
A drawable resource representing the application.

E.g. - < application android:icon="@drawable/icon" / >
< application > tag - description
A string representing a short description of the application.

E.g. < application android:description="@string/app_desc" />
Registering Activities
Every activity that is used within an application must be registered within the manifest file.



E.g. - < activity android:name=".DroidActivity" / >



Each activity must have its own < activity > tag and must be defined as a class within the application package.
< intent-filter > tag
This instructs the Android system to direct all application launch requests to whatever the main activity is.

E.g. - < intent-filter >< action android:name="android.intent.action.MAIN" />< category android:name="android.intent.category.LAUNCHER" />< /intent-filter >

Remember, the < intent-filter > tag is used within the < activity > tag.
< uses-permission > tag
Used for when an application needs to access shared or sensitive resources.

E.g. - < uses-permission android:name="android.permission.CAMERA" />
x of y cards