Android official documentation: (2) Application List -- 2.26 & lt; uses-permission & gt; tag

Source: Internet
Author: User

Syntax:
<uses-permission android:name="string"        android:maxSdkVersion="integer" />
Contained in:
<manifest>
Description:
Requests a permission that the application must be granted inorder for it to operate correctly. Permissions are granted by the user when the application is installed, not while it's running.

For more information on permissions, see the Permissions section in the introduction and the separate Security and Permissions document. A list of permissions defined by the base platform can be foundandroid.Manifest.permission.

Attributes:
android:name
The name of the permission. It can be a permission defined by the application with <permission>Element, a permission defined by another application, or one of the standard system permissions, such" android.permission.CAMERA"Or" android.permission.READ_CONTACTS". As these examples show, a permission name typically provided des the package name as a prefix.
android:maxSdkVersion
The highest API level at which this permission shocould be granted to your app. Setting this attribute is useful if the permission your app requires is no longer needed beginningat a certain API level.

For example, beginning with Android 4.4 (API level 19), it's no longer necessary for your appto requestWRITE_EXTERNAL_STORAGEPermission when yourapp wants to write to its own application-specific directories on external storage (the directoriesprovidedgetExternalFilesDir()). However, the permissionIs requiredFor API level 18 and lower. So you can declare that thispermission is needed only up to API level 18 with a declaration such as this:

<uses-permission     android:name="android.permission.WRITE_EXTERNAL_STORAGE"     android:maxSdkVersion="18" />

This way, beginning with API level 19, the system will no longer grant your appWRITE_EXTERNAL_STORAGEPermission.

Introduced in:
API Level 1
See also:
  • <permission>
  • <uses-feature>

Related Article

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.