The Accelerometer

Smartphones have a device known as an accelerometer that measures the acceleration being applied to the phone. Acceleration is a great way to measure movement. If you shake the phone, you are accelerating it vigorously and rapidly—the accelerometer can easily detect that.

The accelerometer can also detect more subtle accelerations, which are frequently used in games. Users often can tilt or move their devices to impact game play. For example, users might have to navigate a spaceship by physically moving the device to fly in a particular direction.

This type of gaming has become popular in smartphones and helps distinguish their particular hardware capabilities from other types of gaming. If you can learn how to build this capability ...

Get Learning MIT App Inventor: A Hands-On Guide to Building Your Own Android Apps 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.