Getting Started


Core Location provides services for determining a device’s geographic location, altitude, orientation, or position relative to a nearby iBeacon. The framework uses all available onboard hardware, including Wi-Fi, GPS, Bluetooth, magnetometer, barometer, and cellular hardware to gather data.

Before using the Core Location API, make sure it's enabled inside the plugin settings. See the screenshot below:

When you are ready to use location services, follow these steps:

  1. Check to see if your app is authorized to use location services and request permission if your app's authorization status is not yet determined, as described in Requesting Permission to Use Location Services.

  2. Check to see if the appropriate location services are available for you to use, as described in Determining the Availability of Location Services.

  3. Assign a custom object to the SetDelegate method of the ISN_CLLocationManager class. This object must conform to the ISN_iCLLocationManagerDelegate interface.

  4. Configure the properties related to the service you intend to use. For example, when getting location updates, always configure the distanceFilterand desiredAccuracyproperties.

  5. Call the appropriate method to start the delivery of events.

Requesting Permission to Use Location Services.

Current permissions state can be obtained by AuthorizationStatus property. The authorization status of a given app is managed by the system and determined by several factors. Apps must be explicitly authorized to use location services by the user and location services must themselves currently be enabled for the system. A request for user authorization is displayed automatically when your app first attempts to use location services. See the example below.

using SA.iOS.CoreLocation;

ISN_CLAuthorizationStatus status = ISN_CLLocationManager.AuthorizationStatus;
if(status == ISN_CLAuthorizationStatus.AuthorizedAlways ||
   status == ISN_CLAuthorizationStatus.AuthorizedWhenInUse) {
    Debug.Log("Location usage authorized");

In case your applicated does not have location authorization yet. you may use RequestWhenInUseAuthorizationmethod. When the current authorization status is NotDetermined, this method runs asynchronously and prompts the user to grant permission to the app to use location services. The user prompt contains the text from the NSLocationWhenInUseUsageDescription key in your app’s Info.plistfile, and the presence of that key is required when calling this method. After the status is determined, the location manager delivers the results to the delegate’s DidChangeAuthorizationStatus method. If the current authorization status is anything other than NotDetermined, this method does nothing and does not call the DidChangeAuthorizationStatus method.

using SA.iOS.CoreLocation;


You must call this method or the RequestAlwaysAuthorizationmethod prior to using location services. If the user grants “when-in-use” authorization to your app, your app can start most (but not all) location services while it is in the foreground. (Apps cannot use any services that automatically relaunch the app, such as region monitoring or the significant location change service.) When started in the foreground, services continue to run in the background if your app has enabled background location updates in the Capabilities tab of your Xcode project. Attempts to start location services while your app is running in the background will fail. The system displays a location-services indicator in the status bar when your app moves to the background with active location services.

using SA.iOS.CoreLocation;


Starting from iOS 10 you also need to provide a reason for the user why your application want's to use the location services. You can fill it inside the Core Location settings section: