SensorManager

Class of android.hardware · SensorManager.java · Android's reference

public class SensorManager

The device's sensors: none (Off in docs/platforms/android-apps/interfaces.md), as a desktop has none, so a registration fails and no event comes. The rotation helpers compute what Android's do, from their documented definitions.

Fields

public static final float GRAVITY_EARTH = 9.80665f source
public static final float STANDARD_GRAVITY = 9.80665f source
public static final int SENSOR_DELAY_FASTEST = 0 source
public static final int SENSOR_DELAY_GAME = 1 source
public static final int SENSOR_DELAY_UI = 2 source
public static final int SENSOR_DELAY_NORMAL = 3 source
public static final int SENSOR_STATUS_NO_CONTACT = -1 source
public static final int SENSOR_STATUS_UNRELIABLE = 0 source
public static final int SENSOR_STATUS_ACCURACY_LOW = 1 source
public static final int SENSOR_STATUS_ACCURACY_MEDIUM = 2 source
public static final int SENSOR_STATUS_ACCURACY_HIGH = 3 source
public static final int AXIS_X = 1 source
public static final int AXIS_Y = 2 source
public static final int AXIS_Z = 3 source
public static final int AXIS_MINUS_X = AXIS_X | 0x80 source
public static final int AXIS_MINUS_Y = AXIS_Y | 0x80 source
public static final int AXIS_MINUS_Z = AXIS_Z | 0x80 source

Constructors

public SensorManager() empty body source

Methods

public List<Sensor> getSensorList(int type) source
public Sensor getDefaultSensor(int type) source
public Sensor getDefaultSensor(int type, boolean wakeUp) source
public boolean registerListener(SensorEventListener listener, Sensor sensor, int samplingPeriodUs) source
public boolean registerListener(SensorEventListener listener, Sensor sensor, int samplingPeriodUs, int maxReportLatencyUs) source
public boolean registerListener(SensorEventListener listener, Sensor sensor, int samplingPeriodUs, Handler handler) source
public boolean registerListener(SensorEventListener listener, Sensor sensor, int samplingPeriodUs, int maxReportLatencyUs, Handler handler) source
public void unregisterListener(SensorEventListener listener) empty body source
public void unregisterListener(SensorEventListener listener, Sensor sensor) empty body source
public static boolean getRotationMatrix(float[] R, float[] I, float[] gravity, float[] geomagnetic) source

The rotation from the device's frame to the world's (east, north, up) by the gravity and the geomagnetic field, row major, 3x3 or 4x4; the inclination matrix too when I is given. False in free fall or near the poles.

public static float[] getOrientation(float[] R, float[] values) source

azimuth, pitch and roll (radians) of a rotation matrix (3x3 or 4x4)

public static void getRotationMatrixFromVector(float[] R, float[] rotationVector) source

the rotation matrix of a rotation vector (the x, y, z of a unit quaternion, its w given or derived)


Made from ScarletNX's Sail at 166ad3910f80. The framework is ScarletNX's (GPL-3.0-or-later); the parts that follow the Android Open Source Project's sources (Apache-2.0) say so in their files.