- 語法:
<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>
),那麼「只有」在應用程式的運作平台支援執行階段權限模型 (使用者在應用程式執行時授予權限) 的情況下,您才能要求取得權限。如要進一步瞭解權限,請參閱入門簡介的「權限」部分,以及另一份系統權限 API 指南。
android.Manifest.permission
提供基礎平台定義的權限清單。 - 屬性:
-
android:name
- 權限的名稱。應用程式可透過
<permission>
元素定義這個權限。這可以是其他應用程式定義的權限,也可以是標準系統權限之一,例如"android.permission.CAMERA"
或"android.permission.READ_CONTACTS"
。 android:maxSdkVersion
- 應用程式應獲授予這個權限的最高 API 級別。如果安裝應用程式的裝置所搭載的 API 級別高於這個 API 級別,應用程式就無法取得該權限,也無法使用任何相關功能。
- 導入版本:
- API 級別 23
- 另請參閱:
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2022-05-01 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"缺少我需要的資訊"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"過於複雜/步驟過多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"過時"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻譯問題"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/程式碼問題"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"容易理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"確實解決了我的問題"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]