Entertainment

Saturday 13 August 2016

Accelerometer and Access to other Sensors

● An instance of the SensorManager is required in order to
retrieve informations about the supported sensors.

● No permission is required to access the sensor service. It is

then possible to retrieve the list of available sensors of a
certain type.

● For an accelerometer sensor, the type to use is given by the Sensor.TYPE_ACCELEROMETER constant.

● If at least one Sensor exists, it is possible to register a
SensorEventListener for a Sensor of the list.

● It is possible to specify the delivering rate for sensor
events. Specified rate must be one of :

SensorManager.SENSOR_DELAY_FASTEST : as fast as
possible
 
SensorManager.SENSOR_DELAY_GAME : rate suitable for
game
 
SensorManager.SENSOR_DELAY_NORMAL : normal rate
 
SensorManager.SENSOR_DELAY_UI : rate suitable for UI
Thread

No comments:

Post a Comment