Compass sensor on Android
-
I'm using Qt 6.5 and I'm trying to make use of the compass sensor on an Android device.
The problem is that listing all the available sensors, the compass is not among them.This code is from the Qt Sensors documentation:
QList<QSensor*> mySensorList; for (const QByteArray &type : QSensor::sensorTypes()) { qDebug() << "Found a sensor type:" << type; for (const QByteArray &identifier : QSensor::sensorsForType(type)) { qDebug() << " " << "Found a sensor of that type:" << identifier; QSensor* sensor = new QSensor(type, this); sensor->setIdentifier(identifier); mySensorList.append(sensor); } }
Here's the output:
Found a sensor type: "QOrientationSensor"
Found a sensor of that type: "generic.orientation"
Found a sensor type: "QPressureSensor"
Found a sensor of that type: "6"
Found a sensor type: "QProximitySensor"
Found a sensor of that type: "8"
Found a sensor type: "QAccelerometer"
Found a sensor of that type: "1"
Found a sensor of that type: "dummy.accelerometer"
Found a sensor type: "QLightSensor"
Found a sensor of that type: "5"
Found a sensor type: "QAmbientLightSensor"
Found a sensor of that type: "dummy.lightsensor"
Found a sensor of that type: "generic.als"
Found a sensor type: "QTiltSensor"
Found a sensor of that type: "generic.tilt"I have in my AndroidManifest.xml:
<uses-feature android:name="android.hardware.sensor.accelerometer"/> <uses-feature android:name="android.hardware.sensor.compass"/>
Anyone have any idea why I can't get a compass sensor?
-
Never mind. Stupid Samsung AO3s doesn't have a compass.
-