SensorManager sManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
sManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR);
The rotation vector sensor is the most frequently used sensor for motion detection and monitoring. When using SensorManager#getDefaultSensor(int type), always prefer the constant TYPE_GEOMAGNETIC_ROTATION_VECTOR which is similar to TYPE_ROTATION_VECTOR, but using a magnetometer instead of using a gyroscope. This sensor uses lower power than the other rotation vectors, because it doesn’t use the gyroscope. However, it is more noisy and will work best outdoors.
SensorManager sManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
sManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR);
SensorManager sManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
sManager.getDefaultSensor(Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR);