iOS 10 - Bluetooth Stops Advertising When Screen is Locked

Hi,


We have an app that advertises in the background and being able to persistently advertise in the background is a core feature of our app.. We've noticed as of the public iOS 10 beta (could be older) that our app, and seemingly every other advertising app, stops advertising when the phone is locked. Is this intentional, a bug or something that we have to request additional permission from the user to do in iOS 10?


If it is a bug, I am happy to file a radar. I just wanted to find some clarification on whether or not this is the case.

While advertising is now fixed, Scan Options for the CentralManager now have a major impact on discovery performance in iOS10 vs iOS 9.


[__centralManager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:MY_SERVICE_UUID]]
options:@{ CBCentralManagerScanOptionAllowDuplicatesKey : @NO }];


In iOS 7,8,9 the above option would detect services on locked devices etc. in less than a second. On iOS 10.1.1 it can take anywhere from 20 - 40 seconds.


Switching to:


[__centralManager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:MY_SERVICE_UUID]]
options:@{ CBCentralManagerScanOptionAllowDuplicatesKey : @YES }];


results in almost instant discovery again in iOS 10. Is this bug? Or just extreme power saving measure? From the docs:


"A Boolean value that specifies whether the scan should run without duplicate filtering. The value for this key is an

NSNumber
object. If
YES
, filtering is disabled and a discovery event is generated each time the central receives an advertising packet from the peripheral. Disabling this filtering can have an adverse effect on battery life and should be used only if necessary. If
NO
, multiple discoveries of the same peripheral are coalesced into a single discovery event. If the key is not specified, the default value is
NO
."

It seems like a bug as on earlier versions the difference in discovery time between the 2 options was minimal and from my tests the scanning device detects the advertising device almost instantly with @YES set, there's just a large delay until the CentralManager's delegate is called using @NO.

Further testing has revealed the above to be a red herring - there's still a background advertising bug in iOS 10.1.1. 😟


I've create a new topic to cover this new issue:

https://forums.developer.apple.com/thread/67320

Hi Stephen, I see that you have been able to advertice while in the background, even if that does not work with the current IOS10 releases, would you mind sharing how you accomplished this, maybe the frameworks, obj-c + swift, ibeacon or altbeacon, specific requiere settings, etc. I'm trying to understand how people are doing it so I can start building an app that advertices in the background and can be discover by other ios devices looking for it.

iOS 10 - Bluetooth Stops Advertising When Screen is Locked
 
 
Q