The length and contents of the values array vary depending on which
sensor type is being monitored (see also {@link SensorEvent} for a
definition of the coordinate system used):
{@link android.hardware.Sensor#TYPE_ORIENTATION Sensor.TYPE_ORIENTATION}:
All values are angles in degrees.
values[0]: Azimuth, angle between the magnetic north direction and
the Y axis, around the Z axis (0 to 359).
0=North, 90=East, 180=South, 270=West
values[1]: Pitch, rotation around X axis (-180 to 180),
with positive values when the z-axis moves toward the y-axis.
values[2]: Roll, rotation around Y axis (-90 to 90), with
positive values when the x-axis moves away from the z-axis.
Note: This definition is different from yaw, pitch and
roll used in aviation where the X axis is along the long side of
the plane (tail to nose).
Note: It is preferable to use
{@link android.hardware.SensorManager#getRotationMatrix
getRotationMatrix()} in conjunction with
{@link android.hardware.SensorManager#remapCoordinateSystem
remapCoordinateSystem()} and
{@link android.hardware.SensorManager#getOrientation getOrientation()}
to compute these values; while it may be more expensive, it is usually
more accurate.
{@link android.hardware.Sensor#TYPE_ACCELEROMETER Sensor.TYPE_ACCELEROMETER}:
All values are in SI units (m/s^2) and measure the acceleration applied
to the phone minus the force of gravity.
values[0]: Acceleration minus Gx on the x-axis
values[1]: Acceleration minus Gy on the y-axis
values[2]: Acceleration minus Gz on the z-axis
Examples:
When the device lies flat on a table and is pushed on its left
side toward the right, the x acceleration value is positive.
When the device lies flat on a table, the acceleration value is
+9.81, which correspond to the acceleration of the device (0 m/s^2)
minus the force of gravity (-9.81 m/s^2).
When the device lies flat on a table and is pushed toward the sky
with an acceleration of A m/s^2, the acceleration value is equal to
A+9.81 which correspond to the acceleration of the
device (+A m/s^2) minus the force of gravity (-9.81 m/s^2).
{@link android.hardware.Sensor#TYPE_MAGNETIC_FIELD Sensor.TYPE_MAGNETIC_FIELD}:
All values are in micro-Tesla (uT) and measure the ambient magnetic
field in the X, Y and Z axis.