- 语法:
<uses-permission-sdk-23 android:name="string" android:maxSdkVersion="integer" />
- 包含于:
<manifest>
- 说明:
-
指定应用需要特定的权限,但仅当应用安装在搭载 Android 6.0(API 级别 23)或更高版本的设备上时才需要。如果设备运行的是 API 级别 22 或更低版本,则应用就不需要指定的权限。
当您更新应用以包含需要其他权限的新功能时,此元素很有用。如果用户在运行 API 级别 22 或更低版本的设备更新应用,系统在安装时会提示用户授予在该更新中声明的所有新权限。如果某个新功能无关紧要,您可能想同时在这些设备上停用该功能,以便用户不需要授予额外权限即可更新应用。
通过使用
<uses-permission-sdk-23>
元素(而不是<uses-permission>
),您可以只有在应用在支持运行时权限模式的平台上运行时才请求该权限(在运行时权限模式下,用户会在应用运行时授予权限)。如需详细了解权限,请参阅应用清单概览中的权限部分以及 Android 中的权限指南。您可以在
android.Manifest.permission
中找到基础平台定义的权限列表。 - 属性:
-
android:name
-
权限的名称。此权限可以是应用通过
<permission>
元素定义的权限、另一个应用定义的权限,或者一个标准系统权限(例如"android.permission.CAMERA"
或"android.permission.READ_CONTACTS"
)。 android:maxSdkVersion
- 此权限授予应用的最高 API 级别。如果应用安装在 API 级别较高的设备上,则应用不会被授予权限,无法使用任何相关功能。
- 引入于:
- API 级别 23
- 另请参阅:
<uses-permission-sdk-23>
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# <uses-permission-sdk-23\u003e\n\nsyntax:\n:\n\n ```xml\n \u003cuses-permission-sdk-23 android:name=\"string\"\n android:maxSdkVersion=\"integer\" /\u003e\n ```\n\ncontained in:\n: [\u003cmanifest\u003e](/guide/topics/manifest/manifest-element)\n\n\ndescription:\n\n: Specifies that an app wants a particular permission, but only if the app is installed on a device running Android 6.0 (API level 23) or higher. If the device runs API level 22 or lower, the app doesn't want the specified permission.\n This element is useful when you update an app to include a new\n feature that requires an additional permission. If a user updates an app on a\n device that is running API level 22 or lower, the system prompts the user\n at install time to grant all new permissions that are declared in that\n update. If a new feature is minor enough, you might prefer to disable\n the feature altogether on those devices, so the user doesn't have to grant\n additional permissions to update the app.\n\n By using the\n `\u003cuses-permission-sdk-23\u003e` element instead of [`\u003cuses-permission\u003e`](/guide/topics/manifest/uses-permission-element),\n you can request the permission *only* if the app is running on\n platforms that support the [runtime permissions](/training/permissions/requesting)\n model, in which the user\n grants permissions to the app while it is running.\n\n\n For more information on permissions, see the [Permissions](/guide/topics/manifest/manifest-intro#perms)\n section in the app manifest overview and the [Permissions on Android](/guide/topics/permissions)\n guide. A list of permissions defined by the base platform is available\n at [android.Manifest.permission](/reference/android/Manifest.permission).\n\nattributes:\n:\n\n `android:name`\n :\n The name of the permission. This permission can be one defined by the\n app with the [\u003cpermission\u003e](/guide/topics/manifest/permission-element)\n element, it can be a permission defined by another app, or it can be one\n of the standard system permissions, such as\n [\"android.permission.CAMERA\"](/reference/android/Manifest.permission#CAMERA)\n or [\"android.permission.READ_CONTACTS\"](/reference/android/Manifest.permission#READ_CONTACTS).\n\n `android:maxSdkVersion`\n :\n The highest API level at which this permission is granted to your\n app. If the app installs on a device with a later API level, the app\n isn't granted the permission and can't use any related functionality.\n\nintroduced in:\n: API level 23\n\nsee also:\n:\n - [\u003cpermission\u003e](/guide/topics/manifest/permission-element)\n - [`\u003cuses-permission\u003e`](/guide/topics/manifest/uses-permission-element)\n - [\u003cuses-feature\u003e](/guide/topics/manifest/uses-feature-element)"]]