Get advertisement data for BLE in iOS Get advertisement data for BLE in iOS ios ios

Get advertisement data for BLE in iOS


Unfortunately, iOS does not allow you to access the raw advertisement data. I wrote a blog post demonstrating this. While the post is specifically about iBeacons, it applies to any BLE advertisement.

EDIT: To clarify, you can read the raw manufacturer data bytes or service data bytes of non-iBeacon advertisements. It is only the iBeacon advertisements that have their manufacturer data bytes hidden by CoreLocation. See here: Obtaining Bluetooth LE scan response data with iOS

The equivalent MacOS CoreLocation methods do allow this, so it is probably an intentional security or power saving restriction on iOS.


Based on official documentation from Apple iOS and my personal experience:

YES, iOS does not allow you to access the RAW advertisement data.

BUT

If your intention is to put information in advertising packet and read them from the iOS app without connect with the peripheral, this is possible to do.Here is described how:

1) in the peripheral firmware you have to insert your manufacturer specifica data in the advertising packet, with the data type GAP_ADTYPE_MANUFACTURER_SPECIFIC (0xFF)Remember that in the Manufacturer Specific Data, first 2 octets contain the Company Identifier Code followed by the additional manufacturer specific data

2) in the iOS

- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI

You can see the manufacturer specific data in advertisementData dictionary with key:

CBAdvertisementDataManufacturerDataKey

3) if you want that in your App receive a callback notification every advertising packet sent by peripheral to iOS, remember to change the scan option to YES. Look at this post about that: Core Bluetooth - constant RSSI updates of in-range devices

In my blog post will be soon a tutorial: http://www.megabri.com/