Java android.hardware SensorManager fields, constructors, methods, implement or subclass

Example usage for Java android.hardware SensorManager fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for android.hardware SensorManager.

The text is from its open source code.

Field

intSENSOR_ACCELEROMETER
A constant describing an accelerometer.
intDATA_X
Index of the X value in the array returned by android.hardware.SensorListener#onSensorChanged
intDATA_Y
Index of the Y value in the array returned by android.hardware.SensorListener#onSensorChanged
intDATA_Z
Index of the Z value in the array returned by android.hardware.SensorListener#onSensorChanged
floatGRAVITY_EARTH
Earth's gravity in SI units (m/s^2)
floatMAGNETIC_FIELD_EARTH_MAX
Maximum magnetic field on Earth's surface
floatPRESSURE_STANDARD_ATMOSPHERE
Standard atmosphere, or average sea-level pressure in hPa (millibar)
intSENSOR_DELAY_FASTEST
get sensor data as fast as possible
intSENSOR_DELAY_GAME
rate suitable for games
intSENSOR_DELAY_UI
rate suitable for the user interface
intSENSOR_DELAY_NORMAL
rate (default) suitable for screen orientation changes
intSENSOR_STATUS_UNRELIABLE
The values returned by this sensor cannot be trusted, calibration is needed or the environment doesn't allow readings
intSENSOR_STATUS_ACCURACY_LOW
This sensor is reporting data with low accuracy, calibration with the environment is needed
intSENSOR_STATUS_ACCURACY_MEDIUM
This sensor is reporting data with an average level of accuracy, calibration with the environment may improve the readings
intSENSOR_STATUS_ACCURACY_HIGH
This sensor is reporting data with maximum accuracy
intAXIS_X
see #remapCoordinateSystem
intAXIS_Y
see #remapCoordinateSystem
intAXIS_Z
see #remapCoordinateSystem
intAXIS_MINUS_X
see #remapCoordinateSystem
intAXIS_MINUS_Y
see #remapCoordinateSystem
intAXIS_MINUS_Z
see #remapCoordinateSystem

Method

floatgetAltitude(float p0, float p)
Computes the Altitude in meters from the atmospheric pressure and the pressure at sea level.
SensorgetDefaultSensor(int type)
Use this method to get the default sensor for a given type.
float[]getOrientation(float[] R, float[] values)
Computes the device's orientation based on the rotation matrix.
voidgetQuaternionFromVector(float[] Q, float[] rv)
Helper function to convert a rotation vector to a normalized quaternion.
booleangetRotationMatrix(float[] R, float[] I, float[] gravity, float[] geomagnetic)

Computes the inclination matrix I as well as the rotation matrix R transforming a vector from the device coordinate system to the world's coordinate system which is defined as a direct orthonormal basis, where:

  • X is defined as the vector product Y.Z (It is tangential to the ground at the device's current location and roughly points East).
  • Y is tangential to the ground at the device's current location and points towards the magnetic North Pole.
  • Z points towards the sky and is perpendicular to the ground.

World coordinate-system diagram.
voidgetRotationMatrixFromVector(float[] R, float[] rotationVector)
Helper function to convert a rotation vector to a rotation matrix.
ListgetSensorList(int type)
Use this method to get the list of available sensors of a certain type.
booleanregisterListener(SensorListener listener, int sensors, int rate)
Registers a SensorListener for given sensors.
booleanregisterListener(SensorEventListener listener, Sensor sensor, int samplingPeriodUs)
Registers a android.hardware.SensorEventListener SensorEventListener for the given sensor at the given sampling frequency.
booleanregisterListener(SensorEventListener listener, Sensor sensor, int samplingPeriodUs, int maxReportLatencyUs)
Registers a android.hardware.SensorEventListener SensorEventListener for the given sensor at the given sampling frequency and the given maximum reporting latency.
booleanregisterListener(SensorEventListener listener, Sensor sensor, int samplingPeriodUs, Handler handler)
Registers a android.hardware.SensorEventListener SensorEventListener for the given sensor.
booleanremapCoordinateSystem(float[] inR, int X, int Y, float[] outR)

Rotates the supplied rotation matrix so it is expressed in a different coordinate system.

voidunregisterListener(SensorListener listener)
Unregisters a listener for all sensors.
voidunregisterListener(SensorEventListener listener)
Unregisters a listener for all sensors.
voidunregisterListener(SensorListener listener, int sensors)
Unregisters a listener for the sensors with which it is registered.
voidunregisterListener(SensorEventListener listener, Sensor sensor)
Unregisters a listener for the sensors with which it is registered.