i have android application and i used sensors ,
when i tried to get TYPE_ROTATION_VECTOR or TYPE_GAME_ROTATION_VECTOR its returned on some device null ! and this is close my app , so i need to get this on all android device versions , this is my code please help .
this is my code ,
mSensorManager = (SensorManager) context.getSystemService(SENSOR_SERVICE);
mRotationVectorSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_GAME_ROTATION_VECTOR);
if (mRotationVectorSensor != null) {
success = true;
} else {
mRotationVectorSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR);
if (mRotationVectorSensor != null) {
success = true;
}
}
TYPE_ROTATION_VECTOR and TYPE_GAME_ROTATION_VECTOR require a gyroscope. Not all devices have a gyroscope.