Search code examples
bluetooth-lowenergyibeaconibeacon-android

Should I use MacAdress or UUID in iBeacon


I'm developing an app both Android and iOS that needs to read iBeacons and search for an id in the database. This Id should be the macadress or the beacon uuid?


Solution

  • Unfortunately both the MAC address and iBeacon UUID are largely useless for identifying beacons on iOS. Here's why:

    An iBeacon Bluetooth LE advertisement has four identifiers:

    1. A MAC address (48 bits)
    2. An iBeacon UUID (128 bits)
    3. A major identifier (8 bits)
    4. A minor identifier (8 bits)

    The first two identifiers are highly restricted on iOS, so you effectively can't use these to identify the beacon. Apple blocks you from reading the MAC, which makes it unusable on iOS, and Apple APIs require you to specify the iBeacon UUID up front when as a "filter" when looking for beacons. This makes it mostly useless for telling one beacon from the other.

    As a result, on iOS you really need to use the major and minor fields to tell beacons apart (although you can use them along with the UUID if that is helpful.)

    Android doesn't have the same restrictions. You can read the MAC, and you don't have to specify the UUID up front when looking for iBeacon packets. But you may want to do the same thing with Android detections as iOS detections just to keep it simple.