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 typically used with AFGeofencing or AFProximity to detect member presence.
Properties
factoryId A 9-digit alphanumeric code printed inside or on the back of the beacon (hardware ID).
deviceId Beacon identifier assigned by the Mobile API (string name).
facilityId ID of the Facility this beacon is linked to.
uuid Universally Unique Identifier — distinguishes your beacon network from others.
major Major grouping value (e.g., floor, room, or building zone).
minor Minor identifier for an individual beacon within a group.
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