6
votes

I am currently working on an iOS app that is running in the background that requires me to advertise and scan a device using Bluetooth 4.0.

While learning about the Corebluetooth.framework, I found that iOS developers can set two kind of advertising data on the peripheral device.

  1. local name of the device.
  2. service UUIDs.

I learned if the peripheral device is running in the background, however, local name will not be advertised. In addition, service UUIDs will be set to overflow area which the central device can only get by using active scanning. However, the active scanning can be running only in the foreground.

At this point I have a question.

If both central and peripheral devices are running in the background, can a central device get service UUIDs which are set on the overflow area by a peripheral device? That is when both iOS applications are running in the background, is it possible to develop an app that each apps are advertising and scanning each other in the background?

1
Just curious, did you start active scanning and advertising in foreground before app goes into background state?user523234

1 Answers

3
votes

A backgrounded peripheral cannot be found by a backgrounded central exactly for the reasons you describe:

  1. the peripheral does not advertise the services
  2. the central can scan only with service filtering (while backgrounded)

This has been an issue in iOS 6 and I haven't seen anyone being able to do it in iOS 7 until now either. (Further testing in progress.)