AFGeofenceLocationDelegate

class AFGeofenceLocationDelegate(setStatus: (AFGeofencingStatus) -> Unit, onRegionEnterPersist: () -> Unit, onPendingGeofences: () -> List<AFGeofence>? = null) : NSObject, CLLocationManagerDelegateProtocol

Internal class implementing the CLLocationManagerDelegateProtocol to handle geofence events. This class is responsible for receiving notifications when a device enters or exits a monitored region, and also handles dwell time calculations within a region.

Dwell detection uses three layers:

  1. Heartbeat timer — A repeating NSTimer fires every 60 seconds to evaluate dwell thresholds. This is reliable in background because startUpdatingLocation() (with allowsBackgroundLocationUpdates + pausesLocationUpdatesAutomatically = false) keeps the app alive and prevents iOS from suspending it.

  2. Location updates — Each didUpdateLocations callback also checks thresholds, providing an opportunistic dwell evaluation on every location change.

  3. Exit fallback — If the app was killed and relaunched for an exit event, the dwell threshold is checked on region exit using the persisted entry timestamp.

Entry timestamps are persisted to NSUserDefaults via AFGeofenceStore so that dwell duration can be computed even after a process kill. The dwellEmitted set prevents duplicate dwell events when multiple layers trigger.

All geofence transition events (ENTER, EXIT, DWELL) and errors are emitted through AFGeofencingInternal.

Constructors

Link copied to clipboard
constructor(setStatus: (AFGeofencingStatus) -> Unit, onRegionEnterPersist: () -> Unit, onPendingGeofences: () -> List<AFGeofence>? = null)

Properties

Link copied to clipboard
Link copied to clipboard
expect val description: String?
Link copied to clipboard
expect val hash: NSUInteger
Link copied to clipboard
expect val superclass: ObjCClass?

Functions

Link copied to clipboard
expect open override fun class(): ObjCClass?
Link copied to clipboard
expect open override fun conformsToProtocol(aProtocol: objcnames/classes/Protocol??): Boolean
Link copied to clipboard
expect open fun copy(): Any?
Link copied to clipboard
expect open fun debugDescription(): String?
Link copied to clipboard
expect open override fun description(): String?
Link copied to clipboard
expect open fun doesNotRecognizeSelector(aSelector: COpaquePointer?)
Link copied to clipboard
expect open fun finalize()
Link copied to clipboard
expect open fun forwardingTargetForSelector(aSelector: COpaquePointer?): Any?
Link copied to clipboard
expect open fun forwardInvocation(anInvocation: objcnames/classes/NSInvocation??)
Link copied to clipboard
expect open override fun hash(): NSUInteger
Link copied to clipboard
expect open fun init(): NSObject?
Link copied to clipboard
expect open override fun isEqual(object: Any?): Boolean
Link copied to clipboard
expect open override fun isKindOfClass(aClass: ObjCClass?): Boolean
Link copied to clipboard
expect open override fun isMemberOfClass(aClass: ObjCClass?): Boolean
Link copied to clipboard
expect open override fun isProxy(): Boolean
Link copied to clipboard
open override fun locationManager(manager: CLLocationManager, didChangeAuthorizationStatus: CLAuthorizationStatus)
open override fun locationManager(manager: CLLocationManager, didUpdateLocations: List<*>)
open override fun locationManager(manager: CLLocationManager, didEnterRegion: CLRegion)
open override fun locationManager(manager: CLLocationManager, didExitRegion: CLRegion)
open override fun locationManager(manager: CLLocationManager, didStartMonitoringForRegion: CLRegion)
open override fun locationManager(manager: CLLocationManager, didFailWithError: NSError)
open override fun locationManager(manager: CLLocationManager, monitoringDidFailForRegion: CLRegion?, withError: NSError)
open override fun locationManager(manager: CLLocationManager, didDetermineState: CLRegionState, forRegion: CLRegion)
expect open fun locationManager(manager: CLLocationManager, didUpdateHeading: CLHeading)
expect open fun locationManager(manager: CLLocationManager, didVisit: CLVisit)
expect open fun locationManager(manager: CLLocationManager, didFinishDeferredUpdatesWithError: NSError?)
expect open fun locationManager(manager: CLLocationManager, didRangeBeacons: List<*>, satisfyingConstraint: CLBeaconIdentityConstraint)
expect open fun locationManager(manager: CLLocationManager, didRangeBeacons: List<*>, inRegion: CLBeaconRegion)
expect open fun locationManager(manager: CLLocationManager, didFailRangingBeaconsForConstraint: CLBeaconIdentityConstraint, error: NSError)
expect open fun locationManager(manager: CLLocationManager, rangingBeaconsDidFailForRegion: CLBeaconRegion, withError: NSError)
expect open fun locationManager(manager: CLLocationManager, didUpdateToLocation: CLLocation, fromLocation: CLLocation)
Link copied to clipboard
open override fun locationManagerDidChangeAuthorization(manager: CLLocationManager)
Link copied to clipboard
expect open fun locationManagerDidPauseLocationUpdates(manager: CLLocationManager)
Link copied to clipboard
expect open fun locationManagerDidResumeLocationUpdates(manager: CLLocationManager)
expect open fun locationManagerShouldDisplayHeadingCalibration(manager: CLLocationManager): Boolean
Link copied to clipboard
expect open fun methodForSelector(aSelector: COpaquePointer?): IMP?
Link copied to clipboard
expect open fun methodSignatureForSelector(aSelector: COpaquePointer?): objcnames/classes/NSMethodSignature??
Link copied to clipboard
expect open fun mutableCopy(): Any?
Link copied to clipboard
expect open override fun performSelector(aSelector: COpaquePointer?): Any?
expect open override fun performSelector(aSelector: COpaquePointer?, withObject: Any?): Any?
expect open override fun performSelector(aSelector: COpaquePointer?, withObject: Any?, _withObject: Any?): Any?
Link copied to clipboard
expect open override fun respondsToSelector(aSelector: COpaquePointer?): Boolean
Link copied to clipboard
fun startMonitoringRegions(geofences: List<AFGeofence>)
Link copied to clipboard
Link copied to clipboard
expect open override fun superclass(): ObjCClass?