AFGeofence

class AFGeofence(var id: String = "", var latitude: Double = 0.0, var longitude: Double = 0.0, var radius: Float = 150.0f, var dwellTimeMillis: Long = 0)

AFGeofence — represents a circular geofence used for presence detection.

A geofence defines a geographic region where entry, exit, or dwell events can be triggered. AFCore uses these to detect member visits around com.advantahealth.api.facilities.model.Facility locations.

Properties

  • id Unique identifier for the geofence (string).

  • latitude, longitude Center point of the geofence.

  • radius Radius in meters (default = 150m).

  • dwellTimeMillis Minimum time in milliseconds that the user must remain inside the region for a dwell event to be triggered (default = 0L = not tracked).

Notes

Android (Kotlin) — creating a geofence

val gymGeofence = AFGeofence(
id = "facility_42",
latitude = 32.7157,
longitude = -117.1611,
radius = 200f,
dwellTimeMillis = 5 * 60 * 1000L // 5 minutes
)
AFCore.geofencing().startMonitoring(listOf(gymGeofence))

iOS (Swift) — monitoring a geofence

let parkGeofence = AFGeofence(
id: "central_park",
latitude: 40.7851,
longitude: -73.9683,
radius: 300,
dwellTimeMillis: 0
)
try await AFCore.shared.geofencing().startMonitoring([parkGeofence])

Constructors

Link copied to clipboard
constructor(id: String = "", latitude: Double = 0.0, longitude: Double = 0.0, radius: Float = 150.0f, dwellTimeMillis: Long = 0)

Properties

Link copied to clipboard
Link copied to clipboard
var id: String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun toString(): String