3

I'm trying to get the list of paired Bluetooth headset devices on my iPhone. I tried the External Accessory Framework as below:

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

but accessories array is always empty. Did I miss something? what is the right way of getting the list of attached Bluetooth headsets?

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

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

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

Thanks for your help,

Mehrdad

PS: I also tried Apple's sample app which practices External Accessory Framework, no luck!

Mehrdad M
  • 171
  • 2
  • 7
  • The external accessory framework is only for the 30 pin dock connector. – JustSid May 05 '11 at 08:06
  • @JustSid According to Apple's documentation, External Accessory Framework supports external devices wirelessly connected via Bluetooth: "The External Accessory framework provides support for communicating with external hardware connected to an iOS-based device through the 30-pin dock connector or wirelessly using Bluetooth." – Mehrdad M May 06 '11 at 05:00
  • Any luck with this? I'm trying to do the same thing with minimal success. Just want to help pair with a bluetooth headset via an app. – Chazbot Feb 26 '12 at 21:54

2 Answers2

2

Did you ever resolve this? I'm new to the External Accessory Framework, but from what I've found this framework only supports MFi compliant devices: http://developer.apple.com/library/ios/#qa/qa1657/_index.html

mkr707
  • 21
  • 3
0

To resolve this I used AVAudioSeesion from AVFoundation.framework and checked the available inputs with this line of code:

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

if you also need notifications when new device is connected or disconnected you can register observer to AVAudioSessionRouteChangeNotification (you have to open setup new AVAudioSession)

please check my full answer here: https://stackoverflow.com/a/29367963/1787109

Community
  • 1
  • 1
Ben
  • 3,832
  • 1
  • 29
  • 30