2. Overview
• Most Android-powered devices have built-in
sensors that measure motion, orientation, and
various environmental conditions. These sensors
are capable of providing raw data with high
precision and accuracy, and are useful if you
want to monitor three-dimensional device
movement or positioning, or you want to
monitor changes in the ambient environment
near a device
3. The Android platform supports three
broad categories of sensors:
• Motion Sensor
• Environmental sensors
• Position sensors
4. • Motion Sensors
-These sensors measure acceleration forces and
rotational forces along three axes. This category
includes accelerometers, gravity sensors,
gyroscopes, and rotational vector sensors.
5. • Environmental sensors
-These sensors measure various environmental
parameters, such as ambient air temperature and
pressure, illumination, and humidity. This
category includes barometers, photometers, and
thermometers.
6. • Position sensors
-These sensors measure the physical position of a
device. This category includes orientation sensors
and magnetometers.
8. Base Sensors
• Base sensor types are named after the physical
sensors they represent.
• These sensors relay data from a single physical
sensor (as opposed to composite sensors that
generate data out of other sensors).
• Base sensors are not equal to and should not be
confused with their underlying physical sensor.
• Examples of base sensor types include:
SENSOR_TYPE_ACCELEROMETER
SENSOR_TYPE_GYROSCOPE
SENSOR_TYPE_MAGNETOMETER
9. Gyroscope
• A gyroscope sensor reports the rate of rotation of the device
around the 3 sensor axes.
• Allows the device to rotate the screen from portrait to
landscape when you turn your phone as well as use the device
orientation as a controller for games.
• The readings are calibrated using:
temperature compensation
factory (or online) scale compensation
online bias calibration (to remove drift)
• The gyroscope also reports how accurate it expects its
readings to be through sensors_event_t.gyro.status.
• The gyroscope cannot be emulated based on magnetometers
and accelerometers, as this would cause it to have reduced
local consistency and responsiveness. It must be based on a
usual gyroscope chip
10. Heart rate
int TYPE_HEART_RATEA
• Constant describing a heart rate monitor.
• A heart rate sensor reports the current heart rate
of the person touching the device.
• The reported value is the heart rate in beats per
minute.
• The reported accuracy represents the status of
the monitor during the reading.
11. Light
• A constant describing a light sensor type.
• A light sensor reports the current illumination in
SI lux units.
• Measures how bright the ambient light is.
• The measurement is reported
in sensors_event_t.light.
12. • The phone's softwareuses this data to adjust the
display's brightness automatically – when
ambient light is plentiful, the screen's brightness
is pumped up, and when it is dark, the display is
dimmed down. An interesting fact is that high-
end Samsung Galaxy phones use an advanced
light sensor that can measure white, red, green,
and blue light independently. And that's not
overkill. In fact, the Adapt Display feature uses
this data to fine tune image representation.
For example, a game might track readings from a device's gravity sensor to infer complex user gestures and motions, such as tilt, shake, rotation, or swing. Likewise, a weather application might use a device's temperature sensor and humidity sensor to calculate and report the dewpoint, or a travel application might use the geomagnetic field sensor and accelerometer to report a compass bearing.