What Is a Sensor?

In Android, a sensor is a piece of hardware that has been wired into the device to feed data from the physical world to applications. Applications in turn use the sensor data to inform the user about the physical world, to control game play, to do augmented reality, or to provide useful tools for working in the real world. Sensors operate in one direction only; they’re read-only (with one exception, the NFC sensor, which we’ll cover). That makes using them fairly straightforward. You set up a listener to receive sensor data, and then you process the data as it comes in. GPS hardware is like the sensors we cover in this chapter. In Chapter 22, we set up listeners for GPS location updates, and we processed those location updates ...

Get Pro Android 4 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.