Foreground “didDiscover peripheral” update rate drops after 115s

I have been successfully using

didDiscover peripheral
to read data, via Scan Response, from a remote sensor.

I depend on an update rate in excess of 7Hz this is a rate that see for the first 1 minute 54 seconds, after the call to

scanForPeripherals
. Beyond that time (1 minute 54 seconds) the up date rate drops to around 3Hz. The peripherals are still advertising at the same rate.


This behaviour is 100% repeatable.


Auto-Lock is set to "Never"


I assume this is behaviour imposed by Apple to preserve battery life?


Anyone know how to disable it?


using iOS 11 on a 7 Plus

Replies

Apple devices will vary the scan rate as necessary to reduce power consumption and optimize the use of resources shared among various apps and system processes. There are no opportunities for apps to influence this behavior.


Depending on conditions you may see the scan rate fall even further and even notice that a Scan Request (to receive the Scan Response) may not be made at all. Additionally, there is no guarantee (statistically) that every advertising packet will be detected by the device.


Because of all this, trying to deliver critical data via advertising is not a viable solution. If you need guaranteed delivery of your data at a certain required rate, you would find connecting and transferring data that way to be the reliable method.

The solution that seems to work is to simply restart scanning periodically. This restores scanning rate.


I believe there is a limit to the number of simulateous connections? I would like to receive data from 1 - 20 devices on a best effort basis.

The number of devices that can be connected simultaneously is not unlimited.


The actual numbers will vary depending on the version of iOS device, and also what peripherals the user is using already outside your app at the time. Therefore, there is no practical way of knowing what your limits will be ahead of time.


So, your app should always assume it may not simultanously be able to connect to all the peripherals it wants to, and should be able to handle that condition gracefully.