iOS Guides | Samples

MonoTouch.CoreLocation Namespace

The CoreLocation namespace provides classes for tracking and monitoring location, regions (including iBeacons), and geocoding.

Remarks

The Core Location namespace revolves around tracking and monitoring user location, the device's entry-and-exit from regions (either fixed or iBeacon-based), and geocoding between addresses and locations.

Geocoding use-cases center on the CLGeocoder class. Geocoding is simple:

C# Example

async void GeocodeToConsoleAsync (string address) {
    var geoCoder = new CLGeocoder();
    var placemarks = await geoCoder.GeocodeAddressAsync(address);
    foreach (var placemark in placemarks) {
	      Console.WriteLine(placemark);
    }

As is reverse-geocoding:

C# Example

async void ReverseGeocodeToConsoleAsync (CLLocation location) {
    var geoCoder = new CLGeocoder();
    var placemarks = await geoCoder.ReverseGeocodeLocationAsync(location);
    foreach (var placemark in placemarks) {
	      Console.WriteLine(placemark);
    }          
}

Other use-cases typically will start with the CLLocationManager class:

  • Tracking the device's location
  • Region monitoring (Geofencing)
  • iBeacon ranging

These use-cases are discussed in the CLLocationManager class documentation.

Classes

TypeReason
CLActivityTypeAn enumeration whose values specify different types of activity.
CLAuthorizationChangedEventArgsProvides data for the CLAuthorizationChangedEventArgs.AuthorizationChanged event.
CLAuthorizationStatusAn enumeration whose values specify the current status of authorization to use location services.
CLBeaconRepresents a local-area device that can be used for fine-grained location monitoring.
CLBeaconRegionCoreLocation region determined by an iBeacon.
CLCircularRegionA CLRegion defined by a center and a radius (in meters).
CLDeviceOrientationAn enumeration whose values represent the device's physical orientation.
CLErrorErrors returned by the CLLocationManager.
CLFloorInformation describing a building level.
CLGeocodeCompletionHandlerA delegate that is the completionHandler in calls to CLGeocoder.GeocodeAddress.
CLGeocoderProvides support for converting between an address in text form and a location described using latitude and longitude or to convert from a latitue and longitude to a user-friendly location (street, city, state, country).
CLHeadingHeading data as generated by the CLLocationManager.
CLHeadingUpdatedEventArgsProvides data for the CLHeadingUpdatedEventArgs.UpdatedHeading event.
CLLocationLocation information as generated byt he CLLocationManager class.
CLLocationCoordinate2DGeographical coordinates.
CLLocationDistanceA class whose static members define constants relating to filtering and maximum distance.
CLLocationManagerManages the delivery of location, region, and heading events to your application.
CLLocationManagerDelegateVirtual methods on this class receive notifications from the CLLocationManager.
CLLocationManagerDelegate_ExtensionsExtension methods to the ICLLocationManagerDelegate interface to support all the methods from the CLLocationManagerDelegate protocol.
CLLocationManagerEventArgsEvent arguments generated by the CLLocationManager.ShouldDisplayHeadingCalibration event.
CLLocationsUpdatedEventArgsProvides data for the CLLocationsUpdatedEventArgs.LocationsUpdated event.
CLLocationUpdatedEventArgsProvides data for the CLLocationUpdatedEventArgs.UpdatedLocation event.
CLPlacemarkAssociates data such as street address with a coordinate.
CLProximityAn enumeration whose values specify the physical proximity of an iBeacon.
CLRegionThe base class for trackable geographical regions.
CLRegionBeaconsFailedEventArgsProvides data for the CLRegionBeaconsFailedEventArgs.RangingBeaconsDidFailForRegion event.
CLRegionBeaconsRangedEventArgsProvides data for the CLRegionBeaconsRangedEventArgs.DidRangeBeacons event.
CLRegionErrorEventArgsProvides data for the CLRegionErrorEventArgs.MonitoringFailed event.
CLRegionEventArgsProvides data for the CLRegionEventArgs.DidStartMonitoringForRegion, CLRegionEventArgs.RegionEntered and CLRegionEventArgs.RegionLeft events.
CLRegionStateAn enumeration whose values specify whether the device is inside or outside a region or unknown.
CLRegionStateDeterminedEventArgsProvides data for the CLRegionStateDeterminedEventArgs.DidDetermineState event.
CLVisitRelates a location and radius with an arrival and departure time.
CLVisitedEventArgsProvides data for the CLVisitedEventArgs.DidVisit event.
ICLLocationManagerDelegateInterface representing the required methods (if any) of the protocol CLLocationManagerDelegate.