Pages

Wednesday, September 19, 2012

AndroidManifest.xml

Every Android application must have an Androidmanifest.xml file in its root directory. The manifest presents essential information about the application to the Android system, information the system must have before it can run any of the application's code. The components and settings describes in Androidmanifest.xml file.

If you are using Eclipse, you'll find five tabs after opening this file.
  1. Manifest
  2. Application
  3. Permissions
  4. Instrumentation
  5. Androidmanifest.xml


    
        
            
                
                
            
        

    
    

 

Let's understand above code of Androidmanifest.xml file.
<manifest>
The root element of the AndroidManifest.xml file. It must contain an <application> element and specify xmlns:android and package attributes.
 
Attributes

xmlns:android
Defines the Android namespace. This attribute should always be set to "http://schemas.android.com/apk/res/android".

package
A full Java-language-style package name for the application. The name should be unique. The name may contain uppercase or lowercase letters ('A' through 'Z'), numbers, and underscores ('_'). However, individual package name parts may only start with letters.
 
To avoid conflicts with other developers, you should use Internet domain ownership as the basis for your package names (in reverse). For example, applications published by Google start with com.google. You should also never use the com.example namespace when publishing your applications.
 
The package name serves as a unique identifier for the application. It's also the default name for the application process (see the <application> element's process process attribute) and the default task affinity of an activity (see the <activity> element's taskAffinity attribute).
 
android:sharedUserId
The name of a Linux user ID that will be shared with other applications. By default, Android assigns each application its own unique user ID. However, if this attribute is set to the same value for two or more applications, they will all share the same ID — provided that they are also signed by the same certificate. Application with the same user ID can access each other's data and, if desired, run in the same process.

android:sharedUserLabel
A user-readable label for the shared user ID. The label must be set as a reference to a string resource; it cannot be a raw string.
This attribute was introduced in API Level 3. It is meaningful only if the sharedUserId attribute is also set.

android:versionCode
An internal version number. This number is used only to determine whether one version is more recent than another, with higher numbers indicating more recent versions. This is not the version number shown to users; that number is set by the versionName attribute. 

The value must be set as an integer, such as "100". You can define it however you want, as long as each successive version has a higher number. For example, it could be a build number. Or you could translate a version number in "x.y" format to an integer by encoding the "x" and "y" separately in the lower and upper 16 bits. Or you could simply increase the number by one each time a new version is released.

android:versionName
The version number shown to users. This attribute can be set as a raw string or as a reference to a string resource. The string has no other purpose than to be displayed to users. The versionCode attribute holds the significant version number used internally.

android:installLocation
The default install location for the application.



Manifest tab
The manifest tab contains package-wide settings, including the package name, version information, and supported Android SDK information. You can also set any hardware or feature requirements here.

Application tab
The application tab contains application-wide settings, including the application label and icon, as well as information about the application components such as activities, intent filters, and other application components, including configuration for services, intent filters, and content providers.

Permission tab
The permission tab contain any permission rules required by your application. This tab can also be used to enforce custom permissions created for the application.

Instrumentation tab
The instrumentation tab allows the developer to declare any instrumentation classes for monitoring the application.
Androidmanifest.xml
This tab you can use to edit all above tab manually.



    

          

                      

                      

                  

Here's summary of above xml file. 
  • The application uses the package name com.android.multimedia
  • The application version name 1.0
  • The application version code 1
  • The application name and label are stored in resource string called @string/app_name within the /res/values/string.xml resource file.
  • The application is debuggable on an Android device.
  • The application icon is the graphic file called icon (could be a PNG, JPG, or GIF) stored within the /res/drawable directory
  • The application has five activities
    • MultimediaMenuActivity
    • AudioActivity
    • StillImageActivity
    • VideoPlayActivity
    • VideoRecordActivity
  • MultimediaMenuActivity is the primary entry point for the application. This is the activity that starts when the application icon is pressed in the application drawer.
  • The application requires the following permission to run: the ability to record audio, the ability to set the wallpaper on the device, the ability to access the built-in camera, and the ability to write settings.
  • The application works from any API level from 3 to 8; in other words, Android SDK 1.5 is the lowest supported, and the application was written to target android 2.2.
  • Finally, the application requires a camera to work properly.

No comments:

Post a Comment