Search code examples
iosbeaconkontakt.io

Kontakt.io iOS - Identify beacon by name


In my iOS app I have some Points of Interest defined. Some of them have a name of a Kontakt.io beacon, that is binded to a specific PoI (I mean the name that is usually put in the sticker on the beacon). Now I want to discover beacons nearby, then filter out those, that are further than 5 meters, take first from the filtered list and find a PoI using the taken beacon's name.

I was able to acomplish this task on Android version of an app (IBeaconDevice interface used by Kontakt.io has both distance and name inside), however I cannot do this on iOS. I see, that CLBeacon class used by KTKBeaconManager has a field with distance to beacon and KTKNearbyDevice used by KTKDevicesManager has the field for the name, but I have no idea how to link them to each other or how to link my beacon with my PoI using the beacon's name. Is it possible in general or should I switch to identify specific beacons by Minor parameter?


Solution

  • Unfortunately, iOS does not let you correlate a Bluetooth device's advertised name with its iBeacon identifiers, as the underlying CoreBluetooth API (used to get name) and CoreLocation API (used to get beacon UUID, major minor) have no shared identifiers. This is by Apple design in iOS, and restricts the Kontakt.io SDK from doing what you want, as it is dependent on CoreLocation and CoreBluetooth.

    Your only option is you use beacon identifiers from CoreLocation (uuid, major, minor) to select the beacon.