Hour 10. Using the Accelerometer

What You’ll Learn in This Hour

• About the Android sensors

• How to access Android sensors

• How to disable screen rotation

• How to use the accelerometer

This hour covers the broader subject of Android sensor programming, tapping into the hardware sensors included in most Android devices (smartphones and tablets). The emphasis of this hour will be on the most common sensor: the accelerometer. We’ll use the code we study in this hour in the next few hours to assist with using other common Android sensors, such as the ambient light sensor, air pressure sensor, and others.

Android Sensors

Android devices may or may not come with all of the sensors supported by OS 4.0. The SDK supports the following types of sensors ...

Get Sams Teach Yourself Android Game Programming in 24 Hours 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.