How to quickly get a list of paired Bluetooth devices?

I need to get a list of paired bluetooth devices (iOS devices) in the same way as the list in the โ€œBluetoothโ€ section in iOS settings, as shown in the figure below.

enter image description here

Is it possible?
Have you seen applications that perform this function?

I tried the following: link1 , link2 , link3 , link4 , link5 , link6

But nothing helped me get the exact list. Hopefully there should be a way to achieve this. Please help me share my experience. Thanks.

+6
source share
2 answers

You can get a list of paired / connected devices if you have UUID ads .

dispatch_queue_t centralQueu = dispatch_queue_create("A_NAME", NULL); _centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:centralQueu options: @{CBCentralManagerOptionRestoreIdentifierKey:@"RESTORE_KEY", CBCentralManagerOptionShowPowerAlertKey: @YES}]; _ServiceUUIDs = @[[CBUUID UUIDWithString:@"THE_UUID"]] //the array of CBUUIDs which you are looking for [_centralManager retrieveConnectedPeripheralsWithServices:_ServiceUUIDs] 

You can get the UUIDs of advertisements for BLE devices with some iOS apps, such as LightBlue and nRFConnect

+1
source

You need to find the service UUID that you are interested in, in my case it works fine,

 NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], CBCentralManagerScanOptionAllowDuplicatesKey, nil]; [self.centralManager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:SERVICE_UUID]] options:options]; 

and when he finds a device that advertises the same service UUID, it will appear on the screen that you indicated above.

handle did Discoverperipherel as follows:

 -(void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI{ _discoveredPeripheral = peripheral; if(![self.mRemoteDevices containsObject:_discoveredPeripheral]) { NSArray *peripherels = [self.centralManager retrievePeripheralsWithIdentifiers:@[_discoveredPeripheral.identifier]]; [self.mRemoteDevices addObject:[peripherels objectAtIndex:0]]; } } 
0
source

All Articles