Chapter 23. Reading and Responding to Sensors
Point your phone at the sky, and Google Sky Map tells you which stars you’re looking at. Tilt your phone, and you can control the game you’re playing. Take your phone on your daily run, and an app records your route. All of these apps are possible because the mobile devices we carry have high-tech sensors for detecting our location, orientation, and acceleration.
In this chapter, you’ll explore the App Inventor components LocationSensor
, OrientationSensor
, and AccelerometerSensor
. Along the way, you’ll learn about the global positioning system (GPS); orientation measures such as pitch, roll, and azimuth; and some math for processing accelerometer readings.
Creating Location-Aware Apps
Until the popularization of the smartphone, computing was on desktop lockdown. Yes, laptops are mobile, but not in the same sense as the tiny devices we now carry around in our pockets. Computing has left the lab and the office, and is now taking place out in the world, beyond the constraints of four walls.
One significant effect of carrying our computing with us is a new, very interesting piece of data for every app: a current location. Knowing where people are as they move about the world has far-reaching implications and the potential to help us greatly in our lives. It also has the potential to invade our privacy and be a detriment ...
Get App Inventor 2, 2nd Edition 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.