GeofenceManager
open class GeofenceManager : NSObject
extension GeofenceManager: CLLocationManagerDelegate
A singleton object that is responsible for handling geofence related data and events
-
The native
CLLocationManagerDeclaration
Swift
public private(set) var manager: CLLocationManager! -
Listener for
LocationManager.notificationNameeventDeclaration
Swift
open var locationEventListener: NSObjectProtocol? -
The associated
GeofenceClientEventsthat handles client eventsDeclaration
Swift
public var clientEventsManager: GeofenceClientEvents? -
The last known location returned by
LocationManagerDeclaration
Swift
public private(set) var lastKnownLocation: CLLocation?
-
Singleton property
Declaration
Swift
public static let shared: GeofenceManager -
A boolean flag that returns the value of
Configuration.shared.isGeofencingEnabledDeclaration
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 }
-
Starts the
GeofenceManager- validates the value ofisGeofencingEnabled, adds listener forLocationManager.notificationName, event callsLocationManager.shared.checkAndRequestAuthorizationIfNeeded(), and listens for location updates, then will create regions based on the returned locationDeclaration
Swift
open func start() -
Stops the
GeofenceManager- validates the value ofisGeofencingEnabled, callsLocationManager.shared.stopReceivingLocationUpdates(), removes listener forLocationManager.notificationNameeventDeclaration
Swift
open func stop()
-
Calls
stopMonitoringfor each monitoredCLRegionDeclaration
Swift
open func stopMonitoringAllRegions() -
Resets the radius of the monitored
CLRegionDeclaration
Swift
open func updateThresholdRegion(radius: CLLocationDistance) -
Updates monitored regions based on the given
[Place], monitors only up to 19 regionsDeclaration
Swift
open func updateMonitoredRegions(places: [GeofencePlace])
-
Adds an event listener for
LocationManager.notificationNameeventDeclaration
Swift
open func addEventListener() -
Removes an event listener for
LocationManager.notificationNameeventDeclaration
Swift
open func removeEventListener() -
Triggers a
GeofenceClientEvents.tiggerClientEvent(in: CLRegion, event: Place.ClientEventType)given thatLocationManager.shared.isAuthorizedandGeofenceManager.isGeofencingEnabledare both trueDeclaration
Swift
public func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) -
Triggers a
GeofenceClientEvents.tiggerClientEvent(in: CLRegion, event: Place.ClientEventType)given thatLocationManager.shared.isAuthorizedazndGeofenceManager.isGeofencingEnabledare both trueDeclaration
Swift
public func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion)
View on GitHub
GeofenceManager Class Reference