Bond a Low Energy device on Android

  • Hi, I'm trying to bond a ble device. I already did this in the past calling QBluetoothLocalDevice::requestPairing, I don't know if this is exactly the right way to do it, but it works with 5.9.
    Now I need to do this operation with QT > 5.12, but this method seems don't work properly. When I call requestPairing method the QBluetoothLocalDevice::PairingError signal occurs immediately. However the OS panel to pair the device is shown but connection is closed and operation is aborted, so no pairing is possible.
    Is my pairing procedure correct? Is there some other way to do it? Is it a bug?

  • @Darude-0 said in Bond a Low Energy device on Android:

    Is my pairing procedure correct?

    What is your procedure ? Can you show the code ?

    Did you add permissions for Bluetooth in the Android manifest ?

    <uses-permission android:name="android.permission.BLUETOOTH"/>
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

  • Yes, these permissions are included in manifest. I run same code with QT 5.9.8 and works well.
    Here my code, where "target" is a QBluetoothDeviceInfo* from a list of devices discovered by QBluetoothDeviceDiscoveryAgent

        bleController = new QLowEnergyController(*target);
        myAdapter = new QBluetoothLocalDevice();
        if (myAdapter->pairingStatus(target->address()) != QBluetoothLocalDevice::Paired) {
                        this, SLOT(modeStateChanged(QBluetoothLocalDevice::HostMode)));
        else {

  • @Darude-0 I didn't notice that it works on Qt 5.9 sorry. Your code seems correct, it seems like a regression if it doesn't work with Qt 5.12.

  • In my opinion too. I'll try to open an issue

  • Hello Darude!

    Did you resolve this problem?
    I have same it now.