Cover by Reto Meier

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Chapter 12

Hardware Sensors

What's in this Chapter?

Using the Sensor Manager

Introducing the available sensor types

Finding a device's natural orientation

Remapping a device's orientation reference frame

Monitoring sensors and interpreting sensor values

Using sensors to monitor a device's movement and orientation

Using sensors to monitor a device's environment

Modern Android devices are much more than simple communications or web browsing platforms. They are now extra-sensory devices that use hardware sensors, including accelerometers, gyroscopes, and barometers, to provide a platform to extend your perceptions.

Sensors that detect physical and environmental properties offer an exciting avenue for innovations that enhance the user experience of mobile applications. The incorporation of an increasingly rich array of sensor hardware in modern devices provides new possibilities for user interaction and application development, including augmented reality, movement-based input, and environmental customizations.

In this chapter you'll be introduced to the sensors currently available in Android and how to use the Sensor Manager to monitor them.

You'll take a closer look at the accelerometer, orientation, and gyroscopic sensors, and use them to determine changes in the device orientation and acceleration, regardless of the natural orientation of the host device. This is particularly useful for creating motion-based user interfaces (UIs).

You'll also explore the environmental sensors, ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required