Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt simulates accelerometer, how to detect simulated QAccelerometer?
AndreasBuhr last edited by
I developed a little app for Android and PC using Qt 5.2.1. It works nice. There are two ways of interacting with the app: The first way is using the Accelerometer, the second way is using the mouse. The app can switch between these modes. I'd like to use the Accelerometer by default and, if it is not available, use the mouse mode.
When I start my app on the PC, I can use the accelerometer, and it tells me that my device is upright and gravity is 9.8 m/s^2. Since my PC does not have an accelerometer, it seems that an accelerometer is simulated.
How can I distinguish between a real accelerometer and a simulated one?
Just an idea, but you could use the sensor description for that.
Hope it helps
cezmen last edited by
I believe (iOS or Android) simulators or emulators do not simulate or emulate Qt Sensors completely. Although you may detect them, their implemented backends cannot produce real data. For example, on iOS simulator, Accelerometer sensor is detected and can be started by code, but produces no data. For testing Qt Sensors, one must do it in real devices.