I need to do an app which will be able to tell if I am currently connected to a classic Bluetooth device or not (actually, it will be a Bluetooth car device).
My first step is to tell what are the current connected classic Bluetooth devices. I cannot use CoreBluetooth because it's only for LE. I try to use the External Accessory framework.
Here is the code (a button starts the method):
- (IBAction)startMethodGetConnected:(id)sender {
NSLog(@"button taped");
// Get the number of accessories connected
NSUInteger NumberOfAccessoriesConnected = [[EAAccessoryManager sharedAccessoryManager].connectedAccessories count];
//Display the number
NSLog(@"number of accessories connected : %d", NumberOfAccessoriesConnected);
}
I have tried when the iPhone was connected to a Bluetooth keyboard and also with a Bluetooth headset. In both cases, the console displays that the number is 0.
How can I display the correct number?