submitAutomaticVisit

abstract suspend fun submitAutomaticVisit(visitType: VisitType, timestampInSeconds: Long, latitude: Double, longitude: Double, facilityId: String, timeSpentInSeconds: Long): AFResult

Records an automatic visit on behalf of the member.

Call this when the host app detects a qualifying event (e.g., geofence dwell) and wants to log it for the member's calendar/list.

Return

true if the activity was successfully recorded; false otherwise.

Parameters

visitType

The VisitType being recorded (e.g., automatic facility visit).

timestampInSeconds

Event time in epoch seconds.

latitude

Latitude where the activity occurred.

longitude

Longitude where the activity occurred.

facilityId

Optional facility identifier (if known).

timeSpentInSeconds

Optional dwell time inside the facility (seconds).

Throws

on network or validation errors.

Android (Kotlin) — after a geofence event

val ok = AFCore.activities.submitAutomaticVisit(
visitType = VisitType.Automatic,
timestampInSeconds = Clock.System.now().epochSeconds,
latitude = lastLocation.latitude,
longitude = lastLocation.longitude,
facilityId = nearbyFacilityId,
timeSpentInSeconds = dwellSeconds
)
if (ok) refreshUi() // update calendar/list to reflect the new visit

iOS (Swift) — after a proximity trigger

let ok = try await AFCore.shared.activities.submitAutomaticVisit(
visitType: .automatic,
timestampInSeconds: Int64(Date().timeIntervalSince1970),
latitude: coords.latitude,
longitude: coords.longitude,
facilityId: nearbyFacilityId,
timeSpentInSeconds: dwellSeconds
)
if ok { refreshUI() } // update calendar/list with the new visit