Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Corebluetooth advertising and scanning while app in the background

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?

like image 963
hison_l Avatar asked Oct 15 '13 07:10

hison_l


People also ask

How do I enable BLE on my Iphone?

On your iOS device go into "Settings-> Bluetooth" and turn on your BLE device. You should see the device listed in your available devices.

What is Apple iBeacon?

This protocol enables seamless interactivity between iOS and Android devices, and an iBeacon hardware, such as BLE beacons. iBeacon technology has been empowering businesses by letting them welcome customers, provide location-relevant information and promote ongoing offers.

What is UIBackgroundModes?

The UIBackgroundModes key identifies which background tasks your application supports. Its value is an array that contains one or more strings with the following values: audio – The application plays audible content to the user while in the background.

Where is Iphone Bluetooth scanning?

Pair your device with a Bluetooth accessory On your device, go to Settings > Bluetooth and turn on Bluetooth. Stay on this screen until you complete the steps to pair your accessory. Place your accessory in discovery mode and wait for it to appear on your device.


1 Answers

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.)

like image 164
allprog Avatar answered Sep 17 '22 05:09

allprog