Chapter 14. Sensors
WHAT'S IN THIS CHAPTER?
Using the Sensor Manager
The available sensor-types
Monitoring sensors and interpreting sensor values
Using the compass, accelerometer, and orientation sensors
Remapping your orientation reference frame
Controlling device vibration
Modern mobile phones are much more than simple communications devices with a connection to the Internet. With microphones, cameras, accelerometers, compasses, temperature gauges, and brightness detectors, smartphones have become extra-sensory devices, able to augment your own perceptions.
Later chapters will explore use of the camera and microphone; in this chapter you will explore the environmental sensors potentially available on Android devices.
Sensors that detect physical and environmental properties offer an exciting innovation for enhancing the user experience of mobile applications. The incorporation of electronic compasses, gravity sensors, brightness gauges, and proximity sensors in modern devices provides an array of new possibilities for interacting with devices, such as augmented reality and physical movement-based input.
In this chapter you'll be introduced to the sensors available in Android and how to use the Sensor Manager to monitor them. You'll take a closer look at the accelerometer and orientation sensors and use them to determine changes in the device orientation and acceleration. This is particularly useful for creating motion-based user interfaces, letting you add new dimensions to your location-based ...
Get Professional Android™ 2 Application Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.