Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS list of available bluetooth-devices with information programmatically

I am new in this community. I need help solving a problem with Bluetooth in Objective-C. I want to discover all available bluetooth-devices and get information about an existing connection. (Not a scan for peripherals!) Is this possible in iOS? For example the list in Settings > Bluetooth!

like image 523
David Avatar asked Nov 01 '22 15:11

David


1 Answers

Yes and no. It depends on your setup.

No, this is not possible using a public API.

Yes, it is technically possible with the BluetoothManager.framework. My demo project BeeTee¹ shows how and encapsulate the underlying part.

However, based on the AppStore guideline §2.5 on private (undocumented) functions it is not possible to publish apps with the BeeTee and BluetoothManager.framework in the AppStore.

If you decide to go with the BeeTee framework, you could easily list all Bluetooth devices in range:

class Demo: BeeTeeDelegate {
    let beeTee = BeeTee()

    init() {
        beeTee.delegate = self
        beeTee.enableBluetooth()
        beeTee.startScanForDevices()
    }

    func receivedBeeTeeNotification(notification: BeeTeeNotification) {
        switch notification {
        case .DeviceDiscovered:
            for device in beeTee.availableDevices {
                print(device)
            }
        default:
            print(notification)
        }
    }
}

If you are using iOS 11, please consider also the pull request #16. Unfortunately, I am too busy at the moment to merge this pull request yet.

¹ I am the author of BeeTee. :-)

like image 139
Michael Dorner Avatar answered Nov 15 '22 05:11

Michael Dorner