Search code examples
iosbluetoothuniqueuniqueidentifieribeacon

Get unique identifier for beacon in iOS?


I have Jaalee beacons. I tried to connect to them from various phones via various ways including both ibeacon and core bluetooth but all the time I get new identifiers. It means if I don't move and try iphone1 then I get set1 of beacon uuids, then I try iphone2 and get set2, then I try iphone1 and get set1 again. And there are no element which belongs to set1 and set2 simultaneously.

I tried other variables and properties but it seems all of them are common for beacons or different on various iOS devices. How to solve this issue?


Solution

  • Solved. For my case (Jaalee beacons) I should perform a lot of actions in the following order:

    1. scan for beacons
    2. store beacon I found into a dictionary and request its service list
    3. if I get service list then I request characteristic list
    4. if I get characteristic list then I request value for characteristics I need
    5. If all the previous steps are successful then I get beacon proximityUUID, major and minor which are all in common represent "unique identifier"

    All these steps are called asynchronously. Additionally I should delete from dictionary of beacons I found on disconnecting from them. I should also check on some steps if a beacon is still connected.

    UUID which is "too unique" I use for a key in a dictionary because the beacon objects are called asynchronously.