qt_add_android_permission

Adds an Android permission to the target executable.

Adds an Android permission to the target executable.

The command is defined in the Core component of the Qt6 package, which can be loaded like so:

find_package(Qt6 REQUIRED COMPONENTS Core)

This command was introduced in Qt 6.9.

Note

When using this API, the <!-- %%INSERT_PERMISSIONS --> tag must be present in the AndroidManifest.xml. For further information on the use of this tag, see Qt Permissions and Features

Synopsis

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

If versionless commands are disabled, use qt6_add_android_permission() instead. It supports the same set of arguments as this command.

Description

The command adds an Android permission to the target executable. This can be used to define additional permissions, or overriding the default permissions set by Qt modules.

For further information on defining Android permissions, see Qt Permissions and Features .

Example

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
)