Supported Android Sensors

The following is a list of the sensor-types currently available; note that the hardware on the host device determines which of these sensors are actually available to your application.

> Sensor.TYPE_ACCELEROMETER A three-axis accelerometer sensor that returns the current acceleration along three axes in m/s2. The accelerometer is explored in greater detail later in this chapter.

> Sensor.TYPE_GYROSCOPE A gyroscopic sensor that returns the current device orientation on three axes in degrees.

> Sensor.TYPE_LIGHT An ambient light sensor that returns a single value describing the ambient illumination in lux. A light sensor is commonly used to dynamically control the screen brightness.

> Sensor.TYPE_MAGNETIC_FIELD A magnetic field sensor that finds the current magnetic field in microteslas along three axes.

> Sensor.TYPE_ORIENTATION An orientation sensor that returns the device orientation on three axes in degrees. The orientation sensor is explored in greater detail later in this chapter.

> Sensor.TYPE_PRESSURE A pressure sensor that returns a single value, the current pressure exerted on the device in kilopascals.

> Sensor.TYPE_PROXIMITY A proximity sensor that indicates the distance between the device and the target object in meters. How a target object is selected, and the distances supported, will depend on the hardware implementation of the proximity detector. A typical use for the proximity sensor is to detect when the device is being held up against the user's ear and to automatically adjust screen brightness or initiate a voice command.

Using Sensors and the Sensor Manager I 459

> Sensor.TYPE_TEMPERATURE A thermometer that returns temperature in degrees Celsius. The temperature returned may be the ambient room temperature, device battery temperature, or remote sensor temperature, depending on the hardware implementation.

Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide


Post a comment