Floor detection

The automatic recognition of floor plans, locations (a.k.a. venues) and indoor-outdoor transitions are handled in the IndoorAtlas SDK with IARegion events.

// Handling region enter events
- (void)indoorLocationManager:(IALocationManager *)manager didEnterRegion:(IARegion *)region
{
    switch (region.type) {
        case kIARegionTypeVenue:
            NSLog(@"Entered venue %@", region.identifier);
            break;
        case kIARegionTypeFloorPlan:
            NSLog(@"Entered floor plan %@", region.identifier);
            break;
    }
}

// Handling region exit events
- (void)indoorLocationManager:(IALocationManager *)manager didExitRegion:(IARegion *)region
{
    switch (region.type) {
        case kIARegionTypeVenue:
            NSLog(@"Exit venue %@", region.identifier);
            break;
        case kIARegionTypeFloorPlan:
            NSLog(@"Exit floor plan %@", region.identifier);
            break;
    }
}

// Handling region enter events
func indoorLocationManager(_ manager: IALocationManager, didEnter region: IARegion) {

    switch region.type {
    case .iaRegionTypeVenue:
        print("Entered venue \(region.identifier)")
    case .iaRegionTypeFloorPlan:
        print("Entered floor plan \(region.identifier)")
    case .iaRegionTypeGeofence:
        print("Entered geofence \(region.identifier)")
    default:
        break
    }
}

// Handling region exit events
func indoorLocationManager(_ manager: IALocationManager, didExitRegion region: IARegion) {

    switch region.type {
    case .iaRegionTypeVenue:
        print("Exit venue \(region.identifier)")
    case .iaRegionTypeFloorPlan:
        print("Exit floor plan \(region.identifier)")
    case .iaRegionTypeGeofence:
        print("Exit geofence \(region.identifier)")
    default:
        break
    }
}

The IALocationManager delegate must be set before using these events.

self.locationManager.delegate = self;

locationManager.delegate = self

Disabling automatic floor detection

Even though this is not recommended, you can substitute IndoorAtlas floor detection with your own by providing an explicit floor plan by setting the location by locationWithFloorPlanId. This will lock the position into that floor until you provide another floor plan ID.