Track Location and Motion with iOS Location Services - dummies

Track Location and Motion with iOS Location Services

By Neal Goldstein, Dave Wilson

You can develop an iOS 6 app that can determine the device’s current location or even be notified when that location changes, using iOS location services. As people move, it may make sense for your app to tailor itself to where the user is, moment by moment.

Many iPad and iPhone apps use location information to tell you where the nearest coffeehouse is or even where your friends are.

When you know the user’s location, you can even put it on a map, along with other places he or she may be interested in.

All iOS devices contain an accelerometer with three-dimensional data — a component that detects changes in movement. The accelerometer measures change along one of the primary axes in three-dimensional space. An app can, for example, know when the user has turned the device from vertical to horizontal orientation, and it can change the orientation from Portrait to Landscape if doing so makes for a better user experience.

Newer devices add a gyroscope and — together with the accelerometer — improve the ability of the device to measure the direction you are moving it in space.

You can also determine other types of motion such as a sudden start or stop in movement (think of a car accident or a fall) or the user shaking the device back and forth. It makes some way-cool features easy to implement — for example, the Etch A Sketch metaphor of shaking the device to undo an operation.

You can even control a game by moving the iPhone or iPad like a controller — such as the Need for Speed Shift game for the iPad (Electronic Arts), in which you drive the car by using the device like a steering wheel.