Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Geofencing in iOS

Geofencing in iOS

A geofence is a virtual perimeter around a location of interest and, using the Core Location framework, developers can utilize geofences to offer a new range of location-aware features in their apps.

In this session we will learn the basic concepts behind geofencing, consider the design and architectural implications of using geofencing and show how to integrate the feature into your iOS apps.

Kevin McMahon

August 13, 2012
Tweet

More Decks by Kevin McMahon

Other Decks in Programming

Transcript

  1. @property CLLocationAccuracy desiredAccuracy; @property CLLocationDistance distanceFilter; - (void)startUpdatingLocation; - (void)stopUpdatingLocation;

    - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation;
  2. typedef { CLLocationDegrees latitude; // a double CLLocationDegrees longitude; //

    a double } CLLocationCoordinate2D; @properties CLLocationCoordinate2D coordinate; @property (readonly) CLLocationDistance altitude; @property (readonly) CLLocationAccuracy horizontalAccuracy; @property (readonly) CLLocationAccuracy verticalAccuracy; @property (readonly) CLLocationSpeed speed; // in meters/second @property (readonly) CLLocationDirection course; @property (readonly) NSDate *timestamp; - (CLLocationDistance)distanceFromLocation:(CLLocation *)otherLocation;
  3. @property (readonly) NSSet *monitoredRegions; - (void)startMonitoringForRegion:(CLRegion *); - (void)startMonitoringForRegion:(CLRegion *)

    desiredAccuracy:(CLLocationAccuracy); - (void)stopMonitoringForRegion:(CLRegion *); // Delegate Methods - (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region; - (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region; - (void)locationManager:(CLLocationManager *)manager monitoringDidFailForRegion:(CLRegion *)region withError:(NSError *)error;
  4. typedef enum { kCLErrorLocationUnknown = 0, kCLErrorDenied, kCLErrorNetwork, kCLErrorHeadingFailure, kCLErrorRegionMonitoringDenied,

    kCLErrorRegionMonitoringFailure, kCLErrorRegionMonitoringSetupDelayed } CLError; Core Location Errors