Location updates

The central component of the IndoorAtlas location framework is the IALocationManager class, which provides access to IndoorAtlas services.

The IALocationManagerDelegate protocol defines the method to receive location updates. Define the location manager property in the interface section and add the delegate

@interface AppDelegate () <IALocationManagerDelegate>
@property (nonatomic, strong) IALocationManager *locationManager;

class AppDelegate: IALocationManagerDelegate {
    var locationManager: IALocationManager

To start the IndoorAtlas location service

  • Create a shared instance of IALocationManager and point the delegate to the receiver.
  • Set the IndoorAtlas ApiKey and Secret (see here).
  • Request location updates.

Here is a code snippet for authenticating and requesting location updates:

- (void)authenticateAndRequestLocation
    // Get IALocationManager shared instance and point delegate to receiver
    self.locationManager = [IALocationManager sharedInstance];
    self.locationManager.delegate = self;

    // Set IndoorAtlas API key and secret
    [self.locationManager setApiKey:kAPIKey andSecret:kAPISecret];

    // Request location updates
    [self.locationManager startUpdatingLocation];

func authenticateAndRequestLocation() {

    // Get IALocationManager shared instance and point delegate to receiver
    locationManager = IALocationManager.sharedInstance()
    locationManager.delegate = self

    // Set IndoorAtlas API key and secret
    locationManager.setApiKey(kAPIKey, andSecret: kAPISecret)

    // Request location updates

When location data is received from the service, the location manager reports events to the indoorLocationManager:didUpdateLocations: method of its delegate.

// Delegate method from the IALocationManagerDelegate protocol
- (void)indoorLocationManager:(IALocationManager *)manager didUpdateLocations:(NSArray *)locations

    CLLocation *l = [(IALocation *)locations.lastObject location];
    NSLog(@"position changed to coordinate: %.6fx%.6f",
        l.coordinate.latitude, l.coordinate.longitude);

// Delegate method from the IALocationManagerDelegate  protocol.
func indoorLocationManager(_ manager: IALocationManager, didUpdateLocations locations: [Any]) {

    let l = locations.last as! IALocation

    if let newLocation = l.location?.coordinate {
        print("Position changed to coordinate: \(newLocation.latitude) \(newLocation.longitude)")

Advanced features

  • Distance filter It is also possible to filter the location updates by distance. (see the API documentation).