- 語法:
<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> <uses-permission-sdk-23>
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間: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)"]]