iosbluetoothcore-bluetoothbluetooth-lowenergyios-enterprise

Bluetooth LE, scanForPeripheralsWithServices in background, increase speed


I am using Bluetooth LE on iPhone 5S and I have done the following:

Code:

NSDictionary *options = @{
    CBCentralManagerOptionRestoreIdentifierKey:@"myCentralManagerIdentifier",
    CBCentralManagerScanOptionAllowDuplicatesKey:[NSNumber numberWithBool:YES]
};
self.manager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:options];    
[self.manager scanForPeripheralsWithServices:[NSArray arrayWithObject:[CBUUID UUIDWithString:@"<uuid removed>"]] options:options];

The current state is:

Question is:

Is it in some way possible to increase the rate of which iOS is scanning for Bluetooth 4.0 LE peripherals when the scanning app is in background? Since I don't think there is a public API to do this, I am looking for a private API that is not published by Apple. This is for an internal enterprise app so a private API would be perfectly OK.


Solution

  • Background mode works differently for scanning.

    Maybe, you can solve the problem by sending a connect request instead of scanning, while in background. This way, iOS knows that you are really interested in a specific peripheral and I could imagine that this affects discovery times.

    Depending on your goal, a different approach could be to reverse the connection by placing the iPhone in peripheral mode and using your current LE peripherals in central mode. Seems hackish, but if it solves the problem for your case: why not :)

    Regarding a private API: sorry, I don't know one that affects scanning parameters.