2

According to iOS documentation, when an iOS application that utilizes BLE as a peripheral moves to background mode, peripheral name is not advertised and all service UUIDs are placed in a special ‘overflow’ area, they can be discovered only by an iOS device which is explicitly scanning for them.

I sniffed the BLE packets sent over the air when application is in background. There is no local name and service UUID data. There is an 'overflow' area which encodes the service UUID. A brief discussion can be found here: https://github.com/crownstone/bluenet-ios-basic-localization/blob/master/BROADCASTING_AS_BEACON.md

I wish to know if there is any way we can determine the actual service UUID being advertised from the data in 'overflow' area. iOS documentation states that when an app is advertising as BLE peripheral in background, another iOS app can find it by explicitly specifying the service UUIDs to scan for. So, there must be a way to figure out the actual UUID from overflow data.

Any pointers on this would be helpful.

Anutosh
  • 63
  • 1
  • 7

1 Answers1

0

No. The data in the overflow area is hashed (sending several 128-bit UUIDs would be much too large for an advertising packet). I don't believe the hash is documented, but I strongly suspect that it's based on a Bloom filter, so that Apple can probabilistically pack a unlimited number of UUIDs into the very limited space of an advertising packet.

The upside of all of this is that it means the data isn't there in the advertising packet (and really can't be). You will need to connect to the device to discover its services.

Rob Napier
  • 286,113
  • 34
  • 456
  • 610
  • Thanks Rob, I tried connecting to the peripheral in order to discover its services. But it seems that iOS does not allow connection to peripherals while app is in background. – Anutosh Mar 18 '19 at 14:33
  • You generally can connect to known peripherals while the background, and you can be woken up when a peripheral advertising a service you are looking for comes in range. You can't scan for arbitrary devices while in the background in any case (having nothing to do with this particular situation). What the use case here? – Rob Napier Mar 18 '19 at 14:43
  • Use case: An iOS application needs to advertise itself as BLE peripheral in background. A non-iOS Central should be able to scan for and connect to the peripheral advertising in background – Anutosh Mar 18 '19 at 17:03
  • 1
    That is a great use case…I don't know if it's possible. I see now what you mean by "allow connection to peripherals while app is in the background." You mean connecting to the iPhone. In my own work, I've always gone the other way; let the iPhone reach out to the device that advertises the service. I would not be surprised if what you're trying to do is impossible. – Rob Napier Mar 18 '19 at 17:21