Chapter 11: Location Services: Know Where You Are

The ability to know the exact location of the device/user is arguably one of the main differentiating factors that set mobile programming apart from conventional web or native Mac development. That information about where your user is opens up a wealth of ideas and opportunities, and location-based services are arguably one of the hottest categories in the App Store.

The earliest location-based apps showed points of interest within your vicinity. Later, with the gyroscope hardware, some of these apps implemented augmented reality to show the same information. Another category of apps used location information to build a complete business around it—for example, foursquare and Facebook Places. The latest and hottest categories of location-based apps are the turn-by-turn navigation services and location-based reminders.

Apple came up with a couple of location-based apps, Find My Friends and Find My iPhone. Find My Friends helps you locate friends in your vicinity, and Find My iPhone can help you track a lost iDevice.

In this chapter, I briefly go through the basics of using location-based services in your app. Then, in the “Background Location” section I explain in detail the most important aspect of location services: getting a user’s location while your app is running in the background on his or her device. You also learn about managing the life of the device’s battery effectively.

Core Location Framework

Any iOS app that requires ...

Get iOS 6 Programming Pushing the Limits: Advanced Application Development for Apple iPhone, iPad and iPod Touch 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.