LocationMonitor

public class LocationMonitor : NSObject

Location Monitor is used to monitor predefined telemetry regions for each badge.

The client’s location will only be tracked and logged to server within the telemetry regions, starting when user enters the telemtry region. If no telemetry regions are defined for the badge, client’s location will always be tracked and logged to the server.

When the client is offline and within telemetry regions, location data will be stored in the file system. The location data will be logged to server and removed from the file system when client is back online.

  • Singleton

    Declaration

    Swift

    public static let instance: LocationMonitor
  • stop location monitor

    Declaration

    Swift

    public static func stop()
  • The latest location.

    Declaration

    Swift

    public var latestLocation: CLLocation? { get }
  • Variable that stores all defined Telemetry Geo Regions that are monitored or will be monitored

    Declaration

    Swift

    public var existingTelemetryGeoRegions: [CLCircularRegion]
  • Variable that stores all monitored Telemetry Geo Regions by location manager Although locationManager has this property, but use this for the quicker process in unit tests

    Declaration

    Swift

    public var monitoredRegions: Set<CLCircularRegion>
  • Reset LocationMonitor

    Declaration

    Swift

    public func reset()
  • Setup the location monitor:

    If total number of telemetry regions are less than or equal to 20, start monitoring predefined telemetry regions for each badge.

    Otherwise, always track client’s location, but will only report location to server within predefined telemetry regions.

    Declaration

    Swift

    public func setup(badges: [Badge] = [], completion: (() -> Void)? = nil)
    Parameters
    badges

    badges that will be performed location monitor