I am not aware of any other API. The only reference I can find is pointing the BluetoothHIDDevice. I'd say this feature is simply not available for any earlier devices. Of course you can always use reflection via e.g. QtAndroidExtras to add conditional support for this feature to your application. You would guard it behind a runtime version check similar to
From: Roman Wüger <***@gmx.at>
Sent: Saturday, 3 November 2018 8:45:23 AM
To: Jérôme Godbout
Cc: Alex Blasche; Qt Project MailingList
Subject: Re: [Interest] Detect connected Bluetooth keyboard under Android
@Alex: i tried your suggestion but the problem is that the BluetoothHIDDevice class was introduced in API level 28, but I need Level 24.
Maybe this can be done differently with Java?
> Am 01.11.2018 um 19:07 schrieb Jérôme Godbout <***@amotus.ca>:
> There is no way yet to achieve that, at least that I know of, the only thing you can do is monitor the space and dimension to see if the virtual keyboard is displayed. The Android OS will display the soft keyboard or not on his own. You can only try to monitor to see if any changes on size have occurred and you can assume it's for a keyboard. More info can be found over here:
> It's really sad this cannot be easily monitored.
> -----Original Message-----
> From: Interest <email@example.com> On Behalf Of Roman Wüger
> Sent: November 1, 2018 5:58 AM
> To: Alex Blasche <***@qt.io>
> Cc: Qt Project MailingList <***@qt-project.org>
> Subject: Re: [Interest] Detect connected Bluetooth keyboard under Android
> Hi Alex,
> thanks for the hint. My plan was that the user should pair and connect the keyboard manually in the settings dialog. In the application i only want to know if a keyboard is connected, otherwise I will show an onscreen keyboard.
>> Am 30.10.2018 um 08:24 schrieb Alex Blasche <***@qt.io>:
>> As a disclaimer I have not really done any HID work on Android, but based on the Android docs you need to use the BluetoothHidDevice class to interact with such keyboards. BluetoothHidDevice.Callback.onConnectionStateChanged is probably what you need.
>> This Android API is not available via Qt APIs. QBluetoothLocalDevice is for the local Bluetooth device which is not the remote Bluetooth keyboard and HID connects/disconnects cannot be done programmatically by design. The user has to make the connection manually. Therefore I am assuming the platform does not expose such devices via the usual discovery mechanisms either. You have to write your own Java/JNI code to interact with the class.
>> From: Interest <firstname.lastname@example.org> on behalf of Roman Wüger <***@gmx.at>
>> Sent: Monday, 29 October 2018 11:37:32 PM
>> To: Qt Project MailingList
>> Subject: [Interest] Detect connected Bluetooth keyboard under Android
>> Hi @all,
>> i played with the QBluetoothLocalDevice and QBluetoothDiscoveryAgent to detected if a Bluetooth keyboard is connected to an android tablet.
>> However, I can’t find out the correct way. I tried to read the majordeviceclass and minordeviceclass but it doesn‘t work, I only get 31,0 but the documentation says that 5 should be the major device class. The keyboard works in any input fields, but I can‘t find it.
>> I only need a signal if a keyboard connects/disconnects like hardwareKeyboardConnected(bool)
>> What do I need for that?
>> Thanks in advance
>> Interest mailing list
>> Interest mailing list
> Interest mailing list