I'm developing iOS application which works as BLE central.
I have a question about the scan response information.
My application is working in foreground and executing scanForPeripheralsWithService:options() when open app
[self.centralManager scanForPeripheralsWithServices:nil options:@{ CBCentralManagerScanOptionAllowDuplicatesKey : @YES }];
In almost all case, when didDiscoverPeripheral() is called, my application can get the localName of the peripheral with the key @"kCBAdvDataLocalName" in around 30 seconds.
(The peripheral device is developed by other vendor)
Below is the NSLog output of didDiscoverPeripheral() with localName.
[MyApp]: (-[MyBleCentralMgr centralManager:didDiscoverPeripheral:advertisementData:RSSI:]) RSSI=-63, advertisementData={
kCBAdvDataIsConnectable = 1;
kCBAdvDataLocalName = "DeviceName";
kCBAdvDataManufacturerData = <[manufactorer data of peripheral device]>;
}
My application didn't stop scaning after app is killed but we stop scaning device when connected with found peripheral in (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral
In abnormal case:
We've also tried to get right device name but time is increase in around 5 minutes or longer if we're polling open then kill app immediately in many times (hinger 10 times). It seems the callback for discovering API is kept in iOS after we open then kill app immediately when connected peripheral. How we can get right device name around 30~60 seconds in the abnormal stub?