Androidmanifest. xml file (manifest)

Source: Internet
Author: User

Syntax (syntax ):

<Manifestxmlns: Android = "http://schemas.android.com/apk/res/android"
Package ="String"
Android: shareduserid ="String"
Android: shareduserlabel ="String
Resource
"
Android: versioncode ="Integer"
Android: versionname ="String"
Android: installlocation = ["Auto" | "internalonly" | "preferexternal"]>
...
</Manifest>

Included in (contained in ):

None

Required elements (must contain ):

<Application>

Possible Elements (can contain ):

<Instrumentation>

<Permission>

<Permission-group>

<Permission-tree>

<Uses-configuration>

<Uses-Permission>

<Uses-SDK>

Description ):

This element is the root element of the androidmanifest. xml file. It must contain a <Application> element and specify the xmlns: Android and package attributes.

Attributes (attributes ):

Xmlns: Android

This attribute is used to define the namespace of Android. Always set it to http://schemas.android.com/apk/android.

Package

This attribute defines a complete Java style package name for the application. This name should be unique. The name can contain uppercase or lowercase letters, numbers, and underscores ('_'). However, each segment of the package name can only start with a letter.

Use the Internet domain name as the basic package name to avoid conflicts with other developers. For example, the package names of applications published by Google start with COM. Google. Never use the com. Example namespace when publishing an application.

The package name uniquely identifies the application. It is also the default name of the application process (see the process attribute of the <Application> element) and the default kinship task of the activity (see the taskaffinity attribute of the <activity> element ).

Warning once an application is released, its package name cannot be changed. The package name defines the Application Identifier. Therefore, if you change it, it will be considered as a different application, and users of previous versions cannot upgrade the application to the new version.

Android: shareduserid

This attribute defines the name of a Linux User ID, which can be shared with other applications. By default, Android assigns a unique user ID to each of its applications. However, if two or more applications set the same value for this attribute, they will share the same ID-with the same digital signature. Applications with the same user ID can access each other's data, and they can also run in the same process as expected.

Android: shareduserlabel

This attribute defines a user-readable tag for the shared user ID. This tag must be set with string resources and cannot use native strings.

This attribute is introduced in API Level 3. It makes sense only when the shareduserid attribute is set.

Android: versioncode

This attribute defines an internal version number. It is only used to determine whether a version is newer than another version. A larger number indicates a newer version. This version number is not displayed to the user. The version number displayed to the user must be set using the versionname attribute.

The property value must be an integer, such as 100. You can define it according to your own ideas, as long as the subsequent version number is larger. For example, it can be a version number or X. the version numbers in the Y format are converted into a 16-bit integer encoded by X and Y respectively. X is at the lower 8 bits, and Y is at the higher 8 bits; you can also simply increase the number size each time you release a version.

Android: versionname

This attribute is used to set a version number that is displayed to permanent. The attribute value can be a native string or a string resource. This string is not used unless it is displayed to the user. The versioncode attribute has an internal version number.

Android: installlocation

This attribute is used to set the default installation location of the application.

Use the keywords in the following table to set the attribute values.

Value

Description

Internalonly

The application must only be installed on the internal device memory. If this value is set, the application will never be installed on external storage. If the internal storage space is insufficient, the system will not install this application. If the Android: installlocation attribute is not defined, this value is used as the default value.

Auto

Applications can be installed on external storage. However, by default, the system installs applications on internal storage. If the internal storage space is insufficient, the system will install the application on the external storage. Once installed, the user can move the application between internal and external memory through the system settings.

Preferexternal

Applications prefer to be installed on External Storage (SD card ). The system does not guarantee to stick to this rule. If the external storage is unavailable, the space is insufficient, or the application uses the forward-locking mechanism (which does not support external storage), the application can be installed on the internal storage. Once installed, you can move applications between internal and external storage through system settings.

Warning:If your application uses the Google Play replication protection function, it cannot be installed on the SD card of the device. However, if Google Play applications are licensed, they can be installed on internal or external storage, including SD cards.

Note:By default, applications are installed in internal storage, and applications can be installed in external storage only when the attribute value is defined as auto or preferexternal.
When an application is installed on external memory:

1. the APK file is stored in external memory, but any application data (such as databases) is still stored in the internal device memory;

2. Use a keyto encrypt the .apk file stored in the storage device, and only allow the application to run on the device where it is installed. You cannot transfer the application installed on the SD card to the SD card of another device, although multiple SD cards can be used on one device.

3. The application can be transferred to the internal storage as requested by the user.

Users can also require the application to be moved from internal memory to external memory. However, if this attribute is set to internalonly, the system does not allow users to transfer applications to external storage.

This attribute is introduced in API Level 8.

Introduced version (introduced in ):

Unless the introduced API level version is commented out in the attribute description, it is introduced in API Level 1.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.