Skip to content

GeofencesChangeEvent

classGeofencesChangeEvent

Geofence monitoring change delivered to BGGeo.onGeofencesChange.

The SDK can only monitor a finite number of geofences simultaneously. As the device moves, it activates the geofences closest to the current position and deactivates those that are too far away. This event fires whenever that set changes — reporting which geofences just became active (on) and which were just removed from active monitoring (off).

val bgGeo = BGGeo.instance

bgGeo.onGeofencesChange { event ->
    for (geofence in event.on) {
        Log.d(TAG, "[onGeofencesChange] Activated: ${geofence.identifier}")
    }
    for (identifier in event.off) {
        Log.d(TAG, "[onGeofencesChange] Deactivated: $identifier")
    }
}

Members

off

val off: List<String>

Identifiers of geofences that were just deactivated and are no longer being monitored.

on

val on: List<Geofence>

Geofences that just became active and are now being monitored.