Using Sensors to Create a Compass

The Android OS supports a number of types of sensors. Generally, the sensors are either motion, environmental, or position sensors. Motion sensors detect how the device is moving, environmental sensors capture various measures of the device’s ambient environment (for example, the light level), and position sensors capture information that can be used to determine the physical position of the device. Not all devices have all the sensors that the OS supports. This fact has implications for how you code access to the sensors.

Accessing sensor information is not particularly important for the MyContactList app. However, understanding how these are accessed could be important for future apps you develop. In the case ...

Get Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android 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.