GeofenceManager

open class GeofenceManager : NSObject
extension GeofenceManager: CLLocationManagerDelegate

A singleton object that is responsible for handling geofence related data and events

Init

  • Singleton property

    Declaration

    Swift

    public static let shared: GeofenceManager
  • A boolean flag that returns the value of Configuration.shared.isGeofencingEnabled

    Declaration

    Swift

    open var isGeofencingEnabled: Bool { get }
  • A boolean flag that indicates whether the location services and geofencing is allowed

    Declaration

    Swift

    open var isLocationServicesAndGeofencingEnabled: Bool { get }

Control methods

  • Starts the GeofenceManager - validates the value of isGeofencingEnabled, adds listener for LocationManager.notificationName, event calls LocationManager.shared.checkAndRequestAuthorizationIfNeeded(), and listens for location updates, then will create regions based on the returned location

    Declaration

    Swift

    open func start()
  • Stops the GeofenceManager - validates the value of isGeofencingEnabled, calls LocationManager.shared.stopReceivingLocationUpdates(), removes listener for LocationManager.notificationName event

    Declaration

    Swift

    open func stop()

Region control methods

Location Events

  • Adds an event listener for LocationManager.notificationName event

    Declaration

    Swift

    open func addEventListener()
  • Removes an event listener for LocationManager.notificationName event

    Declaration

    Swift

    open func removeEventListener()
  • Triggers a GeofenceClientEvents.tiggerClientEvent(in: CLRegion, event: Place.ClientEventType) given that LocationManager.shared.isAuthorized and GeofenceManager.isGeofencingEnabled are both true

    Declaration

    Swift

    public func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion)
  • Triggers a GeofenceClientEvents.tiggerClientEvent(in: CLRegion, event: Place.ClientEventType) given that LocationManager.shared.isAuthorized aznd GeofenceManager.isGeofencingEnabled are both true

    Declaration

    Swift

    public func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion)