- cú pháp:
<uses-permission-sdk-23 android:name="string" android:maxSdkVersion="integer" />
- có trong:
<manifest>
- mô tả:
-
Chỉ rõ rằng một ứng dụng muốn có một quyền cụ thể, nhưng chỉ khi ứng dụng đó được cài đặt trên một thiết bị chạy Android 6.0 (API cấp độ 23) trở lên. Nếu thiết bị chạy API cấp độ 22 trở xuống, thì ứng dụng không muốn quyền đã chỉ định.
Phần tử này hữu ích khi bạn cập nhật một ứng dụng có một tính năng mới đòi hỏi thêm quyền. Nếu người dùng cập nhật một ứng dụng trên thiết bị chạy API cấp 22 trở xuống, thì tại thời điểm cài đặt, hệ thống sẽ nhắc người dùng cấp tất cả các quyền mới đã khai báo trong bản cập nhật đó. Nếu một tính năng mới chỉ là tính năng thứ yếu, thì bạn nên tắt hoàn toàn tính năng này trên các thiết bị đó để người dùng không phải cấp thêm quyền cập nhật ứng dụng.
Bằng cách sử dụng phần tử
<uses-permission-sdk-23>
thay vì<uses-permission>
, bạn có thể yêu cầu cấp quyền chỉ khi ứng dụng đang chạy trên các nền tảng hỗ trợ mô hình quyền khi bắt đầu chạy, trong đó người dùng cấp quyền cho ứng dụng khi ứng dụng đang chạy.Để biết thêm thông tin về các quyền, hãy xem mục về Quyền trong phần tổng quan về tệp kê khai ứng dụng và hướng dẫn về Quyền trên Android. Bạn có thể xem danh sách quyền do nền tảng cơ sở xác định tại
android.Manifest.permission
. - thuộc tính:
-
android:name
-
Tên quyền. Quyền này có thể được xác định bằng ứng dụng có phần tử
<permission>
, có thể là một quyền do một ứng dụng khác xác định hoặc có thể là một trong các quyền hệ thống tiêu chuẩn, chẳng hạn như"android.permission.CAMERA"
hoặc"android.permission.READ_CONTACTS"
. android:maxSdkVersion
- Cấp độ API cao nhất mà ứng dụng của bạn được cấp quyền này. Nếu cài đặt trên một thiết bị có cấp độ API cao hơn, thì ứng dụng sẽ không được cấp quyền này và không thể sử dụng bất kỳ chức năng nào có liên quan.
- được giới thiệu trong:
- API cấp độ 23
- xem thêm:
<uses-permission-sdk-23>
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],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)"]]