Hi,
I got a problem with the BLE detection when the device locked. Basically i have an app, the central, which scan for peripherals with a specific service. Everything works great in the foreground AND the background (i’m able to detect the device multiple time with the option CBCentralManagerScanOptionAllowDuplicatesKey even if i’m in background, which is not what the documentation said…) My real problem is that as soon as i lock my phone, my app is unable to detect any peripherals (old and new one), unless i set a really short advertisement interval (30 ms) on my peripheral, which is not possible. I asked the question to the Apple tech support but they affirm to me that there is no difference between an app one background with the device locked and unlocked, but my console logs show me the opposite. In my console logs, when i lock my device i can see this:
Apr 18 10:35:10 iPhone-de-Mark SpringBoard[33] <Notice>: (Note ) MC: Locking device. Apr 18 10:35:10 iPhone-de-Mark wirelessproxd[67] <Notice>: (Note ) stopDeviceScan: DBDeviceTypeATVSetup (4)
Could it be related ? (it seems to be a private API and i have no clue of what it really does) Is there a way to discover peripherals with a reasonable advertisement interval in background with the phone locked ?
Here is my config: iPhone 5 iOS 7.1
And my code for launching a scan
dispatch_queue_t backgroundQueue = dispatch_queue_create("fr.mark.testBLE", DISPATCH_QUEUE_SERIAL); self.manager = [[CBCentralManager alloc] initWithDelegate:self queue:backgroundQueue options:@{CBCentralManagerOptionRestoreIdentifierKey:@"test.demo"}];
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], CBCentralManagerScanOptionAllowDuplicatesKey, nil]; [self.manager scanForPeripheralsWithServices:@[KITI_SERVICE] options:options];
Thanks Mark
|