Beacon
class Beacon(var factoryId: String? = null, var deviceId: String? = null, var facilityId: Int = 0, var uuid: String? = null, var major: Long? = null, var minor: Long? = null)
Beacon — represents a Bluetooth beacon associated with a Facility.
Beacons are part of facility metadata returned by the backend.
Notes
Use
uuid + major + minorto uniquely identify a beacon within a network.Beacons support fine-grained facility detection when GPS is unreliable (indoors).
Android (Kotlin) — matching a beacon
val beacons = AFCore.facilities().get() // facilities may include beacon info
beacons.forEach { beacon ->
if (beacon.uuid == scannedUuid && beacon.major == scannedMajor && beacon.minor == scannedMinor) {
println("Beacon belongs to facility ${beacon.facilityId}")
}
}Content copied to clipboard
iOS (Swift) — checking beacon assignment
Task {
do {
let facilities = try await AFCore.shared.facilities().get()
for beacon in facilities.flatMap({ $0.beacons }) {
if beacon.uuid == scannedUuid &&
beacon.major == scannedMajor &&
beacon.minor == scannedMinor {
print("Matched facilityId: \\(beacon.facilityId)")
}
}
} catch {
print("Failed to fetch beacons: \\(error.localizedDescription)")
}
}Content copied to clipboard