Chapter 1, Sensor Fundamentals, provides you a thorough understanding of the
fundamentals and framework of Android sensors. It walks you through the different types
of sensors and the sensor coordinate system in detail.
Chapter 2, Playing with Sensors, guides you through various classes, callbacks, and APIs of
the Android Sensor framework. It walks you through a sample application, which provides
a list of available sensors and their values and individual capabilities, such as the range of
values, power consumption, minimum time interval, and so on.
Chapter 3, The Environmental Sensors – The Weather Utility App, explains the usage of
various environment sensors. We develop a weather utility app to compute altitude,
absolute humidity, and dew point using temperature, pressure, and relative humidity
Chapter 4, The Light and Proximity Sensors, teaches you how to use proximity and light
sensors. It explains the difference between wakeup and non-wakeup sensors and explains
the concept of the hardware FIFO sensor queue. As a learning exercise, we develop a small
application that turns on/off a flashlight using a proximity sensor, and it also adjusts screen
brightness using a light sensor.
Chapter 5, The Motion, Position, and Fingerprint Sensors, explains the working principle of
motion sensors (accelerometer, gyroscope, linear acceleration, gravity, and significant
motion), position sensors (magnetometer and orientation), and the fingerprint sensor. We
learn the implementation of these sensors with the help of three examples. The first
example explains how to use the accelerometer sensor to detect phone shake. The second
example teaches how to use the orientation, magnetometer, and accelerometer sensors to
build a compass, and in the third example, we learn how to use the fingerprint sensor to
authenticate a user.
Chapter 6, The Step Counter and Detector Sensors – The Pedometer App, explains how to use
the step detector and step counter sensors. Through a real-world pedometer application, we
learn how to analyze and process the accelerometer and step detector sensor data to
develop an algorithm for detecting the type of step (walking, jogging, sprinting). We also
look at how to drive the pedometer data matrix (total steps, distance, duration, average
speed, average step frequency, calories burned, and type of step) from the sensor data.
Chapter 7, The Google Fit Platform and APIs – The Fitness Tracker App, introduces you to the
new Google Fit platform. It walks you through the different APIs provided by the Google
Fit platform and explains how to request automated collection and storage of sensor data in
a battery-efficient manner without the app being alive in the background all the time. As a
learning exercise, we develop a fitness tracker application that collects and processes the
fitness sensor data, including the sensor data obtained from remotely connected Android
Bonus Chapter, Sensor Fusion and Sensor – Based APIs (the Driving Events Detection App),
guides you through the working principle of sensor-based Android APIs (activity
recognition, geo-fence, and fused location) and teaches you various aspects of sensor fusion.
Through a real-world application, you will learn how to use multiple sensors along with
input from sensor-based APIs to detect risky driving behavior.