Self-Report
Self-Report allows members to manually log facility visits when automatic detection (geofencing or beacon proximity) was not possible -- for example, when the member forgot to enable location services or visited a facility without beacons.
Data Model
SelfReportData
Returned by get(), this contains the member's facilities eligible for self-reporting and their past self-report history.
| Field | Type | Description |
|---|---|---|
facilities | List<Facility> | Facilities the member can self-report against. |
selfReportMonths | List<SelfReportMonth> | Monthly breakdown of past self-reports. |
statusMessage | String? | Optional server message (e.g., daily limit reached). |
Get Self-Report Data
Retrieve the member's eligible facilities and self-report history.
- Android (Kotlin)
- iOS (Swift)
lifecycleScope.launch {
val data = AFCore.selfReport().get()
val facilities = data.facilities
val history = data.selfReportMonths
// Populate a facility picker and display past reports
}
let data = try await AFCore.shared.selfReport().get()
let facilities = data.facilities
let history = data.selfReportMonths
Submit a Self-Report
Log a manual visit for a specific facility.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
facilityId | Int | Yes | The facility where the visit occurred. |
timestampInSeconds | Long | Yes | UTC epoch timestamp of the visit. |
timeSpentInMinutes | Int | Yes | Duration of the visit in minutes. |
latitude | Double? | No | Device latitude at time of report. |
longitude | Double? | No | Device longitude at time of report. |
atFacility | Boolean | No | Whether the member is currently at the facility (default false). |
- Android (Kotlin)
- iOS (Swift)
lifecycleScope.launch {
val result = AFCore.selfReport().submit(
facilityId = 42,
timestampInSeconds = System.currentTimeMillis() / 1000,
timeSpentInMinutes = 60,
latitude = 32.7157,
longitude = -117.1611,
atFacility = true
)
if (result.status) {
showSuccess("Visit reported successfully")
} else {
showError("Could not submit report: ${result.statusMessage}")
}
}
let result = try await AFCore.shared.selfReport().submit(
facilityId: 42,
timestampInSeconds: Int64(Date().timeIntervalSince1970),
timeSpentInMinutes: 60,
latitude: 32.7157,
longitude: -117.1611,
atFacility: true
)
if result.status {
showSuccess("Visit reported successfully")
} else {
showError("Could not submit report: \(result.statusMessage ?? "Unknown error")")
}
Delete a Self-Report
Remove a previously submitted self-report for a given date.
- Android (Kotlin)
- iOS (Swift)
val result = AFCore.selfReport().delete("2026-02-13")
if (result.status) {
showSuccess("Report deleted")
}
let result = try await AFCore.shared.selfReport().delete("2026-02-13")
if result.status {
showSuccess("Report deleted")
}
Best Practices
- Confirm before submitting. Show a confirmation dialog with the facility name, date, and duration before calling
submit. - Distinguish manual from automatic visits in the UI. Use different icons or labels so members understand which visits were detected automatically and which were self-reported.
- Respect server-side limits. Some organizations limit the number of self-reports per day or month. Check
statusMessagefor guidance.
Quick Reference
- Android (Kotlin)
- iOS (Swift)
AFCore.selfReport().get()
AFCore.selfReport().submit(facilityId, timestampInSeconds, timeSpentInMinutes, lat, lng, atFacility)
AFCore.selfReport().delete(date)
try await AFCore.shared.selfReport().get()
try await AFCore.shared.selfReport().submit(facilityId:timestampInSeconds:timeSpentInMinutes:latitude:longitude:atFacility:)
try await AFCore.shared.selfReport().delete("YYYY-MM-DD")