How to get a list of paired Bluetooth headsets on iPhone?

I am trying to get a list of paired bluetooth headset devices on my iPhone. I tried the structure of external accessories as shown below:

[[EAAccessoryManager sharedAccessoryManager] registerForLocalNotifications];
NSArray *accessories = [[EAAccessoryManager sharedAccessoryManager] connectedAccessories];

but the array of accessories is always empty. Did I miss something? what's the right way to get a list of connected bluetooth headsets?

Assuming I can get a list of Bluetooth headsets, is there a way to redirect the audio output to a specific Bluetooth headset?

according to the code below, there is no way to choose which device will send audio:

UInt32 allowBluetoothInput = 1;
AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryEnableBluetoothInput,
                                sizeof (allowBluetoothInput), &allowBluetoothInput);

Thank you for your help,

Merdad

PS: I also tried Apple's example , which uses Accessory's external infrastructure, no luck!

+3
2

, AVAudioSeesion AVFoundation.framework :

NSArray *availInputs = [[AVAudioSession sharedInstance] availableInputs];

, , AVAudioSessionRouteChangeNotification ( setup new AVAudioSession)

, : fooobar.com/questions/1810341/...

0

All Articles