このページでは

qt_add_android_permission

ターゲットの実行ファイルにAndroidパーミッションを追加します。

このコマンドはQt6 パッケージのCore コンポーネントで定義されています:

find_package(Qt6 REQUIRED COMPONENTS Core)

このコマンドは Qt 6.9 で導入されました。

注: この API を使用する場合、AndroidManifest.xml に<!-- %%INSERT_PERMISSIONS --> タグが存在する必要があります。このタグの使用に関する詳細は、Qt Permissions and Featuresを参照してください。

概要

qt_add_android_permission(target NAME <permission-name> [ATTRIBUTES <name1> <value1> ...])

バージョンレスコマンドが無効になっている場合は、代わりにqt6_add_android_permission() を使用します。このコマンドと同じ引数セットをサポートしています。

説明

このコマンドは、target 実行ファイルに Android パーミッションを追加します。これは、追加のパーミッションを定義したり、Qtモジュールによって設定されたデフォルトのパーミッションを上書きするために使用できます。

Androidパーミッションの定義の詳細については、Qt Permissions and Featuresを参照してください。

qt_add_executable(myapp
    // ...
)
qt_add_android_permission(myapp
    NAME android.permission.BLUETOOTH_SCAN
    ATTRIBUTES
        minSdkVersion 31
        usesPermissionFlags neverForLocation
)
qt_add_android_permission(myapp
    NAME android.permission.ACCESS_COARSE_LOCATION
)

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.