Android Manifest file

AndroidManifest.xml is a powerful file in the Android platform that allows you to describe the functionality and requirements of your application to Android. However, working with it is not easy. Xamarin.Android helps to minimize this difficulty by allowing you to add custom attributes to your classes, which will then be used to automatically generate the manifest for you.

AndroidManifest.xml is generated as part of the build process, and the XML found within Properties/AndroidManifest.xml is merged with XML that is generated from custom attributes. The resulting merged AndroidManifest.xml resides in the obj subdirectory; for example, it resides at obj/Debug/android/AndroidManifest.xml for Debug builds. The merging process is trivial: it uses custom attributes within the code to generate XML elements, and inserts those elements into AndroidManifest.xml.

Android Manifest File

The manifest lets you define the structure and metadata of your application, its components, and its requirements.

  • The manifest also offers attributes to specify application metadata (like its icon or theme), and additional top level nodes can be used for security settings, unit tests, and defining hardware and platform support requirements.
  • The manifest is made up of a root <manifest> tag with a package attribute set to the project‘s package.
  • It usually includes an xmlns:android attribute that supplies several system attributes used within the file.
  • Use the versionCode attribute to define the current application version as an integer. This value is used internally to compare application versions.
  • Use the versionName attribute to specify a public version number that is displayed to users.

A typical manifest node is shown in the following XML snippet:

<manifest xmlns:android=http://schemas.android.com/apk/res/android package="com.my_domain.my_app"
android: versionCode="1" android:versionName="0.9 Beta"> [ ... manifest nodes ... ] </manifest>

The <manifest> tag includes nodes that define the application components, security settings, test classes, and requirements that make up your application. The following list gives a summary of the available <manifest> node tags, and an XML snippet demonstrating how each one is used:

  • uses-sdk : This node lets you define a minimum, maximum, and target SDK version that must be available on a device in order for your application to function properly. Using a combination of minSDKVersion, maxSDKVersion, and targetSDKVersion attributes, you can restrict which devices your application can run on, based on the SDK version supported by the installed platform.

The minimum SDK version specifies the lowest version of the SDK that includes the APIs you have used in your application. If you fail to specify a minimum version, one will be assumed and your application will crash if it attempts to access APIs that aren‘t available on the host device.

The maximum SDK version lets you define an upper limit you are willing to support. Your application will not be visible on the Market for devices running a higher platform release. It‘s good practice not to set the maximum SDK value unless you know your application will definitely not work on newer platform releases.

The supported SDK version is not equivalent to the platform version and cannot be derived from it. For example, Android platform release 2.0 supports the SDK version 5. To find the correct SDK version for each platform use the table at:

  • uses-configuration Use uses-configuration nodes to specify each combination of input mechanisms supported by your application. You can specify any combination of input devices that include:
  • reqFiveWayNav Specify true for this attribute if you require an input device capable of navigating up, down, left, and right and by clicking the current selection. This includes both trackballs and D-pads.
  • reqHardKeyboard If your application requires a hardware keyboard specify true.
  • reqKeyboardType Lets you specify the keyboard type as one of nokeys, qwerty, twelvekey, or undefined.
  • reqNavigation Specify the attribute value as one of nonav, dpad, trackball, wheel, or undefined as a required navigation device.

0 Responses on Android Manifest file"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.