android.hardware.SensorListener |
![]() |
This interface is deprecated.
Use
SensorEventListener
instead.
Used for receiving notifications from the SensorManager when sensor values have changed.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Called when the accuracy of a sensor has changed.
| |||||||||||
Called when sensor values have changed. |
Called when the accuracy of a sensor has changed.
See SensorManager
for details.
sensor | The ID of the sensor being monitored |
---|---|
accuracy | The new accuracy of this sensor. |
Called when sensor values have changed.
The length and contents of the values array vary
depending on which sensor is being monitored.
See SensorManager
for details on possible sensor types.
Definition of the coordinate system used below.
The X axis refers to the screen's horizontal axis (the small edge in portrait mode, the long edge in landscape mode) and points to the right.
The Y axis refers to the screen's vertical axis and points towards the top of the screen (the origin is in the lower-left corner).
The Z axis points toward the sky when the device is lying on its back on a table.
IMPORTANT NOTE: The axis are swapped when the device's screen orientation changes. To access the unswapped values, use indices 3, 4 and 5 in values[].
SENSOR_ORIENTATION
,
SENSOR_ORIENTATION_RAW
:
All values are angles in degrees.
values[0]: Azimuth, rotation around the Z axis (0
All values are in SI units (m/s^2) and measure contact forces.
values[0]: force applied by the device on the x-axis
values[1]: force applied by the device on the y-axis
values[2]: force applied by the device on the z-axis
Examples:
All values are in micro-Tesla (uT) and measure the ambient magnetic
field in the X, Y and -Z axis.
Note: the magnetic field's Z axis is inverted.-STANDARD_GRAVITY
,
which correspond to the force the device applies on the table in reaction
to gravity.
sensor | The ID of the sensor being monitored |
---|---|
values | The new values for the sensor. |