9
votes

I'm hoping to create a BLE advertisement on iOS where I can control the advertisement on a byte level.

One use case would be to mimic an iBeacon advertisement. What is the iBeacon Bluetooth Profile (I want to advertise while my app is in the background which is why I'm not using CoreLocation)

I do not see a way to do this with the Core Bluetooth API. Is this correct? Are there alternatives using private API's or jailbreaking?

3

3 Answers

2
votes

As the others already pointed out, there is no API on iOS that allows you to do this.

You can advertise as an iBeacon, but only when your app is in the foreground. When in background, the advertisement is removed and therefore cannot be discovered anymore (except for other iOS devices which explicitly scan for that service UUID). Also see the documentation here: Core Bluetooth Background Processing

If you would share your use case and what you want to achieve, maybe there are other ways to realise it.

1
votes

My experience with iOS is that if it is something is not exposed in the API, there is no way around, except jailbreaking. For Bluetooth low energy the API is at GAP/GATT level, and very little at the lower levels (if anything) is exposed. Advertising is a LL (link layer) feature.

To illustrate how restricted the access is: When scanning for BLE devices you will not have access to the advertiser's MAC address iOS. In Android you have it.

1
votes

I do not see a way to do this with the Core Bluetooth API. Is this correct?

Since you have to set Manufacture Specific Data in order to achieve this, if nothing has changed you will experience exactly the same issue that I did. Explained here:

The advertisement key 'Manufacturer Data' is not allowed in CoreBluetooth

It is not possible.