ESTMonitoringV2Manager

@interface ESTMonitoringV2Manager : NSObject

Handles beacon enter/exit events using Estimote Monitoring v2.0 algorithm.

Estimote Monitoring uses Core Bluetooth and Core Location frameworks underneath. To make it work when the app is in background, make sure following entries are present in Info.plist file:

  • bluetooth-central, AKA Background Modes -> Uses Bluetooth LE accessories. Allows Core Bluetooth operation in background.

  • NSBluetoothPeripheralUsageDescription, description for Bluetooth alert.

  • NSLocationAlwaysUsageDescription, description for Location alert.

  • Distance boundary between inside and outside states passed in initializer.

    Declaration

    Objective-C

    @property (readonly, assign, nonatomic) double desiredMeanTriggerDistance;

    Swift

    var desiredMeanTriggerDistance: Double { get }
  • Delegate object that monitoring methods will be sent to.

    Declaration

    Objective-C

    @property (readwrite, nonatomic)
        id<ESTMonitoringV2ManagerDelegate> _Nullable delegate;

    Swift

    weak var delegate: ESTMonitoringV2ManagerDelegate? { get set }
  • Core Location region currently used by Estimote Monitoring to improve beacon monitoring reliability when the app is in Background.

    Nil before -startMonitoringForIdentifiers: is called or -stopMonitoring wasn’t called yet.

    Note: This region uses one of 20 Core Location monitoring slots available per app. For more info on global limit of Core Location regions visit: https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/LocationAwarenessPG/RegionMonitoring/RegionMonitoring.html#//apple_ref/doc/uid/TP40009497-CH9-SW5

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable)
        CLBeaconRegion *backgroundSupportRegion;

    Swift

    var backgroundSupportRegion: CLBeaconRegion? { get }
  • Beacon identifiers that monitoring was set up for using -startMonitoringForIdentifiers:.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic)
        NSSet<NSString *> *_Nonnull monitoredIdentifiers;

    Swift

    var monitoredIdentifiers: Set
  • App’s authorization status for beacon monitoring.

    Declaration

    Objective-C

    @property (readonly, assign, nonatomic)
        CLAuthorizationStatus authorizationStatus;

    Swift

    var authorizationStatus: CLAuthorizationStatus { get }

    Return Value

    Authorization status.

  • Designated initializer.

    Note: Due to BLE signal unstability the actual place where notifications occur will differ. The value passed as meanTriggerDistance defines the desired mean distance from the beacon where events should happen.

    Declaration

    Objective-C

    - (nonnull instancetype)
    initWithDesiredMeanTriggerDistance:(double)meanTriggerDistance
                              delegate:(nonnull id<ESTMonitoringV2ManagerDelegate>)
                                           delegate;

    Swift

    init(desiredMeanTriggerDistance meanTriggerDistance: Double, delegate: ESTMonitoringV2ManagerDelegate)

    Parameters

    meanTriggerDistance

    Distance boundary between inside and outside states. Enter/exit events are reported when crossing these states.

    delegate

    Delegate object to invoke callbacks on.

    Return Value

    Initialized object.

  • Start monitoring beacons with given identifiers and start reporting monitoring events for these beacons to delegate.

    Overwrite the previously monitored identifiers when called multiple times.

    Note: In order to work, beacon monitoring requires an Always or WhenInUse authorization to use Core Location services. See requestWhenInUseAuthorization and requestAlwaysAuthorization methods. In case of insufficient authorization status monitoringManager:didFailWithError: method is called on a delegate.

    Declaration

    Objective-C

    - (void)startMonitoringForIdentifiers:
        (nonnull NSArray<NSString *> *)identifiers;

    Swift

    func startMonitoring(forIdentifiers identifiers: [String])

    Parameters

    identifiers

    Identifiers of beacons to be monitored. Device identifer can be read by visiting https://cloud.estimote.com/#/

  • Stop monitoring beacons with identifiers passed to -startMonitoringForIdentififers:.

    Additionally, stop Core Location beacon monitoring for -backgroundSupportRegion.

    Declaration

    Objective-C

    - (void)stopMonitoring;

    Swift

    func stopMonitoring()
  • Informs about the current monitoring state of a proximity zone defined by a beacon.

    Declaration

    Objective-C

    - (ESTMonitoringState)stateForBeaconWithIdentifier:
        (nonnull NSString *)identifier;

    Swift

    func stateForBeacon(withIdentifier identifier: String) -> ESTMonitoringState

    Parameters

    identifier

    Identifier of the beacon.

    Return Value

    Current monitoring state for the zone.

  • Requests permission for monitoring beacons while the app is in the foreground.

    Declaration

    Objective-C

    - (void)requestWhenInUseAuthorization;

    Swift

    func requestWhenInUseAuthorization()
  • Requests permission for monitoring beacons whenever the app is running.

    Declaration

    Objective-C

    - (void)requestAlwaysAuthorization;

    Swift

    func requestAlwaysAuthorization()