IALocationManager

Objective-C


@interface IALocationManager : NSObject

Swift

class IALocationManager : NSObject

The IALocationManager class is central point for configuring the delivery of indoor location related events to your app. You use and instance of this class to establish the parameters that determine when location events should be delivered and to start and stop the actual delivery of those events. You can also use a location manager object to retrieve the most recent location data.

The shared IALocationManager instance is thread safe. (since SDK version 3.3+)

  • The latest location update.

    This property can be set for a custom location.

    Declaration

    Objective-C

    @property (nonatomic, nullable) IALocation *location;

    Swift

    var location: IALocation? { get set }
  • The latest sample of device attitude.

    Declaration

    Objective-C

    @property (nonatomic, nullable) IAAttitude *attitude;

    Swift

    var attitude: IAAttitude? { get set }
  • The latest sample of device heading.

    Declaration

    Objective-C

    @property (nonatomic, nullable) IAHeading *heading;

    Swift

    var heading: IAHeading? { get set }
  • The minimum distance measured in meters that the device must move horizontally before an update event is generated. Setting this to 0 disables distance based updates. Maximum update frequency is determined from values of distanceFilter and timeFilter. Update is generated when either of conditions specified by these filters are met. Default value is 0.7 meters. Uses CoreLocation CLLocationDistance.

    Declaration

    Objective-C

    @property (nonatomic) CLLocationDistance distanceFilter;

    Swift

    var distanceFilter: CLLocationDistance { get set }
  • The minimum amount of time measured in seconds that must be elapsed before an update event is generated. Setting this to 0 disables time based updates. Maximum update frequency is determined from values of distanceFilter and timeFilter. Update is generated when either of conditions specified by these filters are met. Default value is 2.

    Declaration

    Objective-C

    @property (nonatomic) NSTimeInterval timeFilter;

    Swift

    var timeFilter: TimeInterval { get set }
  • The minimum angular change in degrees required to generate new didUpdateHeading event. Default value is 1 degree.

    Declaration

    Objective-C

    @property (nonatomic) CLLocationDegrees headingFilter;

    Swift

    var headingFilter: CLLocationDegrees { get set }
  • The minimum angular change in degrees required to generate new didUpdateAttitude event. Default value is 1 degree.

    Declaration

    Objective-C

    @property (nonatomic) CLLocationDegrees attitudeFilter;

    Swift

    var attitudeFilter: CLLocationDegrees { get set }
  • The accuracy of the location data.

    The receiver does its best to achieve the requested accuracy; however, the actual accuracy is not guaranteed. You should assign a value to this property that is appropriate for your usage scenario. Determining a location with greater accuracy requires more time and more power.

    Default value is kIALocationAccuracyBest.

    See possible values at ia_location_accuracy

    Declaration

    Objective-C

    @property (nonatomic) enum ia_location_accuracy desiredAccuracy;

    Swift

    var desiredAccuracy: ia_location_accuracy { get set }
  • Set the accuracy of the underlying CLLocationManager’s instance.

    By default the SDK uses different values depending on the situation. Setting this overrides the SDK logic.

    Declaration

    Objective-C

    @property (nonatomic) CLLocationAccuracy desiredPlatformAccuracy;

    Swift

    var desiredPlatformAccuracy: CLLocationAccuracy { get set }
  • Set the activity type of the underlying CLLocationManager’s instance.

    By default the SDK does not set this value.

    Declaration

    Objective-C

    @property (nonatomic) CLActivityType platformActivityType;

    Swift

    var platformActivityType: CLActivityType { get set }
  • Explicitly enable background location updates. (iOS 9.0+ only)

    Location updates must be active when app goes to background for this flag to have effect. If you have enabled background execution in some other way, you may still receive location updates in background even if this flag is not set.

    NOTE! you must also enable the Location updates background mode and include NSLocationAlwaysAndWhenInUseUsageDescription key in your app’s Info.plist file, and the user must authorize the always on background location permission in order for this flag to have any effect.

    For more info, see:

    https://developer.apple.com/documentation/corelocation/getting_the_user_s_location/handling_location_events_in_the_background

    https://developer.apple.com/documentation/corelocation/cllocationmanager/1620568-allowsbackgroundlocationupdates

    https://developer.apple.com/documentation/corelocation/choosing_the_authorization_level_for_location_services/requesting_always_authorization

    Default value is false, i.e. background location updates are not explicitly enabled

    Declaration

    Objective-C

    @property (nonatomic) BOOL allowsBackgroundLocationUpdates;

    Swift

    var allowsBackgroundLocationUpdates: Bool { get set }
  • The set of (dynamic) geofences monitored by the location manager. Note that automatically monitored cloud geofences are not included.

    You cannot add geofences to this property directly. Instead use the [IALocationManager startMonitoringGeofence:] method.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSArray<IAGeofence *> *monitoredGeofences;

    Swift

    var monitoredGeofences: [IAGeofence]? { get }
  • The latest extra information dictionary.

    Used for debugging positioning.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSDictionary *extraInfo;

    Swift

    var extraInfo: [AnyHashable : Any]? { get }

Accessing the Delegate

SDK version

  • Returns SDK version string.

    The version string returned is in format “major.minor.patch”. (see: Semantic Versioning)

    Declaration

    Objective-C

    + (nonnull NSString *)versionString;

    Swift

    class func versionString() -> String
  • Locks positioning to specified floor level

    Declaration

    Objective-C

    - (void)lockFloor:(int)floorNumber;

    Swift

    func lockFloor(_ floorNumber: Int32)

    Parameters

    floorNumber

    Floor level where the positioning is restricted

  • Unlocks positioning from locked floor. If lockFloor has not been called before, this is no-op.

    Declaration

    Objective-C

    - (void)unlockFloor;

    Swift

    func unlockFloor()
  • Lock or unlock positioning indoors. Disables indoor-outdoor detection when locked. Indoor lock is enabled by default.

    Declaration

    Objective-C

    - (void)lockIndoors:(_Bool)lockIndoor;

    Swift

    func lockIndoors(_ lockIndoor: Bool)

    Parameters

    lockIndoor

    boolean value indicating whether to lock or unlock indoor positioning

Authenticate your session

  • Set IndoorAtlas API key and secret for authentication.

    This method must be called once before starting location updates. Changing API key at runtime will stop location updates and reset state.

    Declaration

    Objective-C

    - (void)setApiKey:(nonnull NSString *)key andSecret:(nonnull NSString *)secret;

    Swift

    func setApiKey(_ key: String, andSecret secret: String)

    Parameters

    key

    API key used for authentication.

    secret

    API secret used for authentication.

  • Starts the generation of updates that report the user’s current location.

    This method returns immediately. Calling this method causes the location manager to obtain an initial location fix (which may take several seconds) and notify your delegate by calling its [IALocationManagerDelegate indoorLocationManager:didUpdateLocations:] method. After that, the receiver ` generates update events whenever there is new estimate.

    Calling this method several times in succession does not automatically result in new events being generated. Calling [IALocationManager stopUpdatingLocation] in-between, however, does cause a new initial event to be sent the next time you call this method.

    If you start this service and your app is suspended, the system stops the delivery of events until your app starts running again (only in foreground). If your app is terminated, the delivery of new location events stops altogether.

    Declaration

    Objective-C

    - (void)startUpdatingLocation;

    Swift

    func startUpdatingLocation()
  • Stops the generation of location updates.

    Call this method whenever your code no longer needs to receive location-related events. Disabling event delivery gives the receiver the option of disabling the appropriate hardware (and thereby saving power) when no clients need location data. You can always restart the generation of location updates by calling the method again.

    Declaration

    Objective-C

    - (void)stopUpdatingLocation;

    Swift

    func stopUpdatingLocation()
  • Starts monitoring the specified geofence. Note that cloud geofences are monitored automatically.

    You must call this method once for each geofence you want to monitor. If an existing geofence with the same identifier is already being monitored by the app, the old geofence is replaced by the new one. Geofence events are delivered as regions to the indoorLocationManager:didEnterRegion: and indoorLocationManager:didExitRegion: methods of your delegate.

    Declaration

    Objective-C

    - (void)startMonitoringForGeofence:(nonnull IAGeofence *)geofence;

    Swift

    func startMonitoring(for geofence: IAGeofence)

    Parameters

    geofence

    The geofence object that defines the boundary to monitor.

  • Stops monitoring the specified geofence.

    If the specified geofence object is not currently being monitored, this method has no effect.

    Declaration

    Objective-C

    - (void)stopMonitoringForGeofence:(nonnull IAGeofence *)geofence;

    Swift

    func stopMonitoring(for geofence: IAGeofence)

    Parameters

    geofence

    The geofence object currently being monitored.

  • Start monitoring for wayfinding updates. Calling this method causes the location manager to obtain a route from user’s current location to destination defined in parameter “to” (this may take several seconds). Calling this method notify your delegate by calling its indoorLocationManager:didUpdateRoute: method. After that, the receiver generates update events whenever the route changes.

    Calling this method several times in succession overwrites the previously done requests. Calling in-between, however, does cause a new initial event to be sent the next time you call this method.

    Declaration

    Objective-C

    - (void)startMonitoringForWayfinding:(nonnull id<IALatLngFloorCompatible>)to;

    Swift

    func startMonitoring(forWayfinding to: IALatLngFloorCompatible)

    Parameters

    to

    An object specifying the wayfinding destination

  • Stops monitoring for wayfinding updates.

    Call this method whenever your code no longer needs to receive wayfinding route update events. You can always restart the generation of wayfinding route updates by calling the method again.

    Declaration

    Objective-C

    - (void)stopMonitoringForWayfinding;

    Swift

    func stopMonitoringForWayfinding()
  • Request a single-shot wayfinding route. Callback with route result is called from the application main thread.

    Declaration

    Objective-C

    - (void)requestWayfindingRouteFrom:(nonnull id<IALatLngFloorCompatible>)from
                                    to:(nonnull id<IALatLngFloorCompatible>)to
                              callback:
                                  (void (^_Nonnull)(IARoute *_Nonnull))callback;

    Swift

    func requestWayfindingRoute(from: IALatLngFloorCompatible, to: IALatLngFloorCompatible, callback: @escaping (IARoute) -> Void)

    Parameters

    from

    An object specifying the wayfinding starting location

    to

    An object specifying the wayfinding destination

    callback

    callback to call with route result

  • Lazily creates AR session.

    To release memory and stop all AR related processing you must call releaseArSession.

    NOTE! To enable AR features, please contact IndoorAtlas sales.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) IAARSession *arSession;

    Swift

    var arSession: IAARSession? { get }
  • Stops all AR related activity and releases the memory allocated for it.

    Declaration

    Objective-C

    - (void)releaseArSession;

    Swift

    func releaseArSession()
  • Start monitoring for beacons.

    Whenever IA SDK internally scans beacons, by calling this method the scans are also delivered to indoorLocationManager:didRangeBeacons: method of your delegate.

    NOTE! To enable the callback, please contact IndoorAtlas support.

    Declaration

    Objective-C

    - (void)startMonitoringForBeacons;

    Swift

    func startMonitoringForBeacons()
  • Stop monitoring for beacons.

    Declaration

    Objective-C

    - (void)stopMonitoringForBeacons;

    Swift

    func stopMonitoringForBeacons()
  • Finish recording binary log data. This method is mainly meant for enterprise users to share debug data with the IndoorAtlas support. If your API key already has data storage enabled, there is no need to use this method.

    Declaration

    Objective-C

    - (void)finishRecordingBinaryLog:(void (^_Nonnull)(NSData *_Nonnull))callback;

    Swift

    func finishRecordingBinaryLog(_ callback: @escaping (Data) -> Void)
  • Returns the shared instance.

    Declaration

    Objective-C

    + (nonnull IALocationManager *)sharedInstance;

    Swift

    class func sharedInstance() -> IALocationManager