Compatibility Map¶
Overview of supported sensors for each platform
In addition to the table above, each sensor type might support specific features. For example, a magnetometer might support returning geo values. See isFeatureSupported() for additional details.
Platform specific notes¶
Windows¶
The Windows backend is supported in Qt installations that were built with MSVC.
Android¶
The sensors provided by the Android backend can be read without requesting any Android permission.
The only restriction concerns the sampling rate of the accelerometer, gyroscope, and magnetometer. Starting from Android 12 (API level 31), reading these sensors at a rate higher than 200 Hz requires the android.permission.HIGH_SAMPLING_RATE_SENSORS permission. This is a normal permission that is granted at install time without prompting the user. If the permission is not declared, the sampling rate is capped at 200 Hz.
Declare the permission for the application with qt_add_android_permission:
qt_add_android_permission(myapp NAME android.permission.HIGH_SAMPLING_RATE_SENSORS )
Note
When using a hand-written AndroidManifest.xml, it must contain the <!-- %%INSERT_PERMISSIONS --> tag for the permission to be added. See Qt Permissions and Features.
HarmonyOS¶
Some sensors on HarmonyOS require a permission before their data can be read:
QAccelerometerrequiresohos.permission.ACCELEROMETER.
QGyroscoperequiresohos.permission.GYROSCOPE.
The other sensors provided by the HarmonyOS backend (the light sensor, magnetometer, and rotation sensor) can be read without any permission.
Subscribing to a sensor whose permission has not been granted fails, and no readings are delivered.
Declare a permission for the application with qt_add_harmonyos_permission:
qt_add_harmonyos_permission(myapp NAME ohos.permission.ACCELEROMETER )