1
votes

I and my team are working on a beacon that we need to talk to an app on the user's iPhone. Since we need the app to detect the beacon and execute code to talk to our API even when killed, we cannot use CoreBluetooth and need to operate as a beacon.

We're attempting to make a custom beacon on a BCM20737S BLE module. Is it possible to have this custom beacon talk to an app on an iPhone as a beacon? (CoreLocation framework)

Thanks!

2

2 Answers

1
votes

As long as your packet is broadcasting a packet with the iBeacon protocol, then corelocation can detect it and your app will wake based on detection of this signal. An iBeacon protocol packet is a 25 byte payload set as the manufacturer data field in the BLE advertisement.

  1. The company ID is 2 bytes (0x004C)
  2. The type is 1 byte (0x02)
  3. Data Length is 1 byte (0x015)
  4. Proximity UUID is a 16 byte Hex String
  5. Major is 2 bytes uint16_t
  6. Minor is 2 bytes uint16_t
  7. Measured Power is 1 byte int8_t

This stack thread might be of some use to you.

What is the iBeacon Bluetooth Profile

But essentially corelocation is only configured for ibeacons, if you want to transmit a different protocol packet youre going to need to use CoreBluetooth on iOS, then once you receive the packet, translate it somehow for use with your app.

1
votes

The CoreLocation framework will only detect iBeacons, which means beacons that meet the iBeacon byte format. You can certainly build your own, and while it does not have to be an official Apple certified iBeacon, but it does have to match the byte pattern. This pattern is widely available on the internet, even if you do not sign up for Apple's certification program that earns you the right to see the spec.

Be careful, however, that you make no changes to rhe byte pattern. Some vendors have built beacon transmissions that tack extra bytes on to the end to send the battery level. While these transmissions are detected, they are detected much more slowly because the header has a different length field, which does not match the hardware filter used for rapid detection in the background.

If you want to customize your beacon format, you must use CoreBluetooth for detections. I have written some open source iOS beacon tools that help do this, using the open source AltBeacon and Eddystone-UID formats as examples. While detections in the background are slower as you say, you can make your beacon transmit both an iBeacon signal (to wake up your app quickly) and a custom beacon signal (to send whatever custom fields you want) to be detected as soon as it is awoken. This way you get fast detection even if you define your own custom beacon format.