I basically want search the nearby BLE devices from my iOS app, even when the app is in background.
iOS provides this method:
//_cbcManager is the object of CBCentralManager
[_cbcManager scanForPeripheralsWithServices:nil options:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:CBCentralManagerScanOptionAllowDuplicatesKey]]
This method will scan for all the services (since nil is provided in the parameter). But this won't work in background. iOS needs specific service names when the app is in background.
I basically want to scan the audio devices, reading this page: https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx I have provided most of the generic services that an audio device may broadcast. So now, the method looks something like this:
[_cbcManager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:@"180A"], [CBUUID UUIDWithString:@"1815"], [CBUUID UUIDWithString:@"1800"], [CBUUID UUIDWithString:@"1801"], [CBUUID UUIDWithString:@"1807"], [CBUUID UUIDWithString:@"180E"], [CBUUID UUIDWithString:@"1813"], [CBUUID UUIDWithString:@"181C"]] options:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:CBCentralManagerScanOptionAllowDuplicatesKey]]
Is there a specific/generic service name which every BLE device will broadcast?