[ Web Proxy ]
URL:
Viewing: https://developer.android.com/reference/android/hardware/SensorListener [Back]  [Original]

SensorListener  |  API reference  |  Android Developers Skip to main content
Essentials Design & Plan Develop Google Play Blog
Search:
Android Studio
Android Developers [Android Developers]
Stay organized with collections Save and categorize content based on your preferences.
Added in API level 1
Deprecated in API level 3

SensorListener


public interface SensorListener

android.hardware.SensorListener


This interface was deprecated in API level 3.
Use SensorEventListener instead.

Used for receiving notifications from the SensorManager when sensor values have changed.

Summary

Public methods

abstract void onAccuracyChanged(int sensor, int accuracy)

Called when the accuracy of a sensor has changed.

abstract void onSensorChanged(int sensor, float[] values)

Called when sensor values have changed.

Public methods

onAccuracyChanged

Added in API level 1
public abstract void onAccuracyChanged (int sensor, 
                int accuracy)

Called when the accuracy of a sensor has changed. See SensorManager for details.

Parameters
sensor int: The ID of the sensor being monitored

accuracy int: The new accuracy of this sensor.

onSensorChanged

Added in API level 1
public abstract void onSensorChanged (int sensor, 
                float[] values)

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


Web Proxy Viewer  |  New URL  |  Original Page