You are previewing iPhone Location Aware Apps by Example.
O'Reilly logo
iPhone Location Aware Apps by Example

Book Description

Build five complete location enabled augmented reality apps with this book and ebook.

  • Gain in depth knowledge of the location-based world, using real world examples.

  • Master the new iOS 5 Location Simulator to fine tune your apps.

  • Implement the best of the Location APIs and SDKs available now and incorporate them in your apps

In Detail

From weather apps which give you a forecast based on your current location to fitness apps which track your speed and distance travelled. From Google Maps to Foursquare. Increasing mobility and social networking has made location awareness an integral aspect of modern iPhone applications.

This book will teach you everything you need to know about building iPhone location aware apps, from simple Google maps to complex region monitoring and augmented reality. Build five real world location aware apps and get a taste of HTML5-based mobile app development.

The book begins by explaining behind-the-scenes working of location-based systems, including GPS. Explore in depth iOS Core Location and the MapKit Framework, using examples depicting each capability of the respective frameworks. Having learnt about location and maps, you will build five location-based apps using the APIs and SDKs publicly available. The book has everything for a beginner as well as advanced users, with chapters devoted to advanced topics such as push notifications, geo fencing and augmented reality.

Table of Contents

  1. iPhone Location Aware Apps by Example
    1. iPhone Location Aware Apps by Example
    2. Credits
    3. About the Author
    4. About the Reviewers
    5. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    7. 1. The Location-based World
      1. Understanding Location-based Services
      2. Time for action — consuming Location-based Services with Google
        1. What just happened?
      3. Buzzwords in the Location-based Industry
      4. Application of LBS and common use cases
        1. Military
        2. Government
        3. Commercial
      5. How Apple uses LBS in the iPhone, iPad, and iPod devices
        1. iOS location API
      6. Time for action — turning off Location Tracking in your iPhone
        1. What just happened?
      7. Behind LBS — GPS
        1. User segment
        2. Space segment
        3. Control segment
      8. Push and Pull methods of Location Services
        1. Push Service
        2. Pull Service
      9. Life without GPS: Wi-Fi-based location detection
      10. Life without GPS: cell ID positioning and cell tower triangulation
      11. Time for action — using the SkyHook Wireless Loki framework to determine your location
        1. What just happened?
      12. Life without GPS: Google Maps API
      13. Understanding Indoor and Outdoor Navigation
        1. Pop quiz — play safe with location!
      14. Summary
    8. 2. The Xcoder's World
      1. Introducing Xcode 4
      2. Xcode 4: Prerequisites and features
        1. Prerequisites
        2. Features
      3. iOS 5 and Xcode 4.2: new and notable features
        1. iOS 5 new features
        2. Xcode 4.2's new features
      4. Transitioning from Xcode3: What you need to know
      5. Time for action — installation
        1. What just happened?
      6. Time for action — Hello Location
        1. What just happened?
      7. Tools for the overnight coders: HTML5
        1. PhoneGap
      8. Time for action — using PhoneGap to build a Hello Location App
        1. What just happened?
      9. Time for action — using Titanium Appcelerator for building the Hello Location app
        1. What just happened?
      10. Time for action — Hello Location with Sencha Touch
        1. What just happened?
      11. Exploring location-based SDKs/APIs
        1. Foursquare
        2. Gowalla
        3. Eventful and Last.fm API — some music is always good
      12. Still more tools: SimpleGeo and Factual
        1. Other Notable APIs — YQL and Location Labs
        2. Pop quiz — so you think you can Xcode
      13. Summary
    9. 3. Using Location in your iOS Apps — Core Location
      1. Core Location framework an — overview
      2. Time for action — location debugging
        1. What just happened?
      3. Core location services
        1. Standard location
        2. Significant change
        3. Region monitoring
        4. Geocoding and reverse Geocoding — CLGeocoder
        5. Direction using heading
      4. Core Location Manager — CLLocationManager
      5. Time for action — checking for location service availability
        1. What just happened?
        2. User authorization
      6. Time for action — using Core Location with user authorization
        1. What just happened?
      7. The CLLocation object
      8. Time for action — receiving location updates in your application
        1. What just happened?
      9. Time for action — boundary monitoring with Location Manager
        1. What just happened?
        2. Have a go hero — remembering a user's location with Core Data
      10. Extending Hello Location for nearby events
        1. Important things to know before we begin
      11. Time for action — extending Hello Location for nearby events
        1. What just happened?
      12. Time for action — Last.fm API in your app
      13. What just happened?
      14. Extending Hello Location for local search
        1. Important things to know before we begin
      15. Time for action — building a local search app with foursquare
        1. What just happened?
        2. Pop quiz — Location, Location, and Location
      16. Summary
    10. 4. Using Maps in your iOS apps MapKit
      1. Overview of the MapKit framework
      2. Understanding map geometry
      3. Time for action — using MapKit in your app
        1. What just happened?
      4. Time for action — using map gestures panning and zooming
      5. Annotating Maps an overview
      6. Time for action — adding annotations to your maps
      7. Time for action — draggable annotations
        1. What just happened?
      8. Time for action — custom map annotations
        1. What just happened?
        2. Have a go hero — use CLRegion to detect a user's city
      9. Map overlays an overview
      10. Time for action — customizing map annotations
      11. User tracking modes
      12. Bonus — offline maps in your app
      13. Time for action — using OpenStreetMaps with CloudMade API
        1. What just happened?
        2. Have a go hero — creating an offline map
        3. Pop quiz — Map Mania
      14. Summary
    11. 5. Weather App WeatherPackt
      1. Storing and retrieving the user's location with SQLite
      2. Time for action — storing and retrieving the user's location with SQLite
        1. What just happened?
      3. Converting location data into city name — using Geonames API
        1. A bit on GeoNames
      4. Time for action — converting location data into city name
        1. What just happened?
      5. Consuming the WeatherBug API
        1. Important things to know before we begin
      6. Time for action — using WeatherBug API
        1. What just happened?
        2. Have a go hero — creating the Weather Alert function
      7. Building your Weather App: WeatherPackt
        1. Start a new Xcode project
      8. Define the Home screen
      9. Time for action — defining the Home screen
        1. Set up a default location
        2. Formatting the Weather API for display
        3. The settings page
        4. Have a go hero — adding the Alerts page to WeatherPackt
      10. Bonus: building WeatherPackt with PhoneGap
      11. Bonus: text-to-speech
        1. Pop quiz — Weather Alert
      12. Summary
    12. 6. Events App — PacktEvents
      1. PacktEvents: Overview and architecture
        1. Architecture of PacktEvents
      2. Storing and Retrieving Events with SQLite
      3. Time for action — storing and retrieving events with SQLite
        1. What just happened?
      4. Plotting events on a map
      5. Time for action — plotting events on a map
        1. What just happened?
        2. Have a go hero — add more dynamics to the map
      6. Filtering Events display by Event Categories
      7. Time for action — filtering Events by categories
        1. What just happened?
      8. Using the Event Kit framework to add events to your iPhone calendar
      9. Time for action — adding events to your iPhone calendar
        1. What just happened?
      10. Using the Twitter framework
      11. Time for action — adding Twitter capabilities to your iPhone app
        1. What just happened?
      12. Bonus: using the Layar Player API in your app: Augmented Reality
      13. Time for action — adding Augmented Reality to your iPhone app
        1. What just happened?
      14. PacktEvents: building the app
        1. Pop quiz — have a blast with events
      15. Summary
    13. 7. Advanced Topics
      1. Using directions with location
        1. Direction using heading
          1. Getting your app ready for direction
          2. Understanding heading using magnetometer
      2. Time for action — using heading for direction in your app
        1. What just happened?
        2. Direction using course
      3. Time for action — using course for direction in your app
        1. What just happened?
      4. Core Motion: Motion Manager
        1. How to use Core Motion
      5. Time for action — using MotionManager: accelerometer
        1. What just happened?
          1. Core Motion conclusion
      6. Background app execution
        1. What apps can run in the background?
        2. Background location
          1. Understanding the iOS application life cycle
        3. Push notifications - overview
        4. Local notifications
      7. Time for action — using local notifications
        1. What just happened?
        2. Have a go hero — add local notifications to WeatherPackt
        3. Pop quiz — the rocket science
      8. Summary
    14. 8. Local Search PacktLocal
      1. Consuming the foursquare venue API
        1. Venue categories
      2. Time for action — consuming the foursquare venue API - categories
        1. What just happened?
      3. Recommended and popular venues
      4. Time for action — recommended and popular venues
        1. What just happened?
      5. Search for venues
      6. Time for action — exploring the foursquare Search API
        1. What just happened?
      7. Building an UI for our local search app - PacktLocal
      8. Saving venue information on the device
      9. Building the app: PacktLocal
      10. Time for action — building the app - PacktLocal
        1. What just happened?
        2. Have a go hero — implement the add venue endpoint
      11. Summary
    15. 9. Location Aware News — PacktNews
      1. Understanding the Patch News API — HyperLocal News
        1. Authentication
        2. Taxonomy
          1. Vertical
          2. Format
          3. Author
        3. Finding stories by location
        4. Find location by names
      2. Time for action — consuming the Patch News API
        1. What just happened?
        2. Adding the Geo Fencing support
      3. Time for action — adding the Geo Fencing support
        1. What just happened?
      4. Building our app - PacktNews
        1. A bit on StoryBoard
      5. Time for action — building PacktNews
        1. What just happened?
      6. Summary
    16. 10. Social Governance — TweetGovern
      1. Social governance — an overview
      2. TweetGovern — behind the scenes
        1. Stackmob
        2. Our approach: Twitter
        3. Icons and images
        4. SDKs and frameworks
      3. Time for action — creating the UI for TweetGovern
        1. What just happened?
      4. Time for action — detecting the user location and showing nearby issues
        1. What just happened?
      5. Time for action — creating and voting for an issue
        1. What just happened?
        2. Have a go hero — adding search to TweetGovern
        3. Pop quiz
      6. Summary
    17. A. Pop-Quiz Answers
      1. Chapter 1, The Location-Based World
        1. Pop quiz — play safe with location !
      2. Chapter 2, The Xcoder’s World
        1. Pop quiz — so you think you can Xcode
      3. Chapter 3, Using Location in your iOS Apps Core Location
        1. Pop quiz — location, location, and location
      4. Chapter 4, Using Maps in your iOS apps - MapKit
        1. Pop quiz — map mania
      5. Chapter 5, Weather App - WeatherPackt
        1. Pop quiz — weather alert
      6. Chapter 6, Events App - PacktEvents
        1. Pop quiz — have a blast with events
      7. Chapter 7, Advanced Topics
        1. Pop quiz — the rocket science
      8. Chapter 10, Social Governance - TweetGovern
        1. Pop quiz