Currently I recognize beacons, as CLBeacon
objects. Example:
CLBeacon (uuid:F7826DA6-4FA2-4E98-8024-BC5B71E0893E, major:57140, minor:4299, proximity:1 +/- 0.77m, rssi:-75)
But I need here the name of the beacon. I mean b1A8
:
Is there any way to access it from code?
Now, I do it like this:
func beaconManager(_ manager: KTKBeaconManager, didRangeBeacons beacons: [CLBeacon], in region: KTKBeaconRegion) {
for beacon in beacons {
//here need to have a name
}
}
The iBeacon format itself doesn't allow for custom data to be included on the advertising packet, so Kontakt.io beacons have a custom scan response packet, which includes things like battery, firmware version, transmission power, and most importantly: unique ID (b1A8).
Because this isn't an iBeacon advertisement packet, you'll need to rely on Core Bluetooth instead of Core Location. If you're using their SDK, you can do so by using KTKDevicesManager, and KTKNearbyDevice.
From their developer center:
extension ViewController: KTKDevicesManagerDelegate {
func devicesManager(_ manager: KTKDevicesManager, didDiscover devices: [KTKNearbyDevice]?) {
guard let nearbyDevices = devices else {
return
}
for device in nearbyDevices {
if let uniqueId = device.uniqueID {
print("Detected a beacon \(uniqueId)")
} else {
print("Detected a beacon with an unknown Unique ID")
}
}
}
}