0

In my ipad when I go to Bluetooth Setting page I can see my Samsung headset device (HM 1100) in the connected list. However when I use the following code I could not get any accessories.

NSArray *accessories = [[EAAccessoryManager sharedAccessoryManager]
                                connectedAccessories];
        EAAccessory *accessory = nil;

        for (EAAccessory *obj in accessories)
        {
            NSLog(@"Found accessory named: %@", obj.name);
        }

Is there a way for an app to detect which bluetooth devices are connected to the ipad? Is there any way to list any unknown bluetooth peripherals in iOS?

Manab Kumar Mal
  • 20,788
  • 5
  • 31
  • 43

2 Answers2

2

In iOS, "Classic Bluetooth" devices are exposed as their underlying service object, not as Bluetooth objects, so a headset is visible as an audio path in the AVAudioSession class.

The External Accessory framework is used to interface with devices that are certified under the MFi program.

Paulw11
  • 108,386
  • 14
  • 159
  • 186
0

i have found that answer in how to find Bluetooth audio devices in iOS

This is the base code:

// portDesc.portType could be for example - BluetoothHFP, MicrophoneBuiltIn, MicrophoneWired
NSArray *availInputs = [[AVAudioSession sharedInstance] availableInputs];
int count = [availInputs count];
for (int k = 0; k < count; k++) {
    AVAudioSessionPortDescription *portDesc = [availInputs objectAtIndex:k];
    NSLog(@"input%i port type %@", k+1, portDesc.portType);
    NSLog(@"input%i port name %@", k+1, portDesc.portName);
}
Community
  • 1
  • 1
Manab Kumar Mal
  • 20,788
  • 5
  • 31
  • 43