@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?

Regards 
Roman

> Am 01.11.2018 um 19:07 schrieb Jérôme Godbout <godbo...@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:
> https://stackoverflow.com/questions/2150078/how-to-check-visibility-of-software-keyboard-in-android
> https://groups.google.com/forum/#!topic/android-platform/FyjybyM0wGA
> 
> It's really sad this cannot be easily monitored.
> 
> -----Original Message-----
> From: Interest <interest-bounces+godboutj=amotus...@qt-project.org> On Behalf 
> Of Roman Wüger
> Sent: November 1, 2018 5:58 AM
> To: Alex Blasche <alexander.blas...@qt.io>
> Cc: Qt Project MailingList <interest@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.
> 
> Thanks
> 
> Regards
> Roman
> 
> 
>> Am 30.10.2018 um 08:24 schrieb Alex Blasche <alexander.blas...@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.
>> 
>> --
>> Alex
>> 
>> ________________________________________
>> From: Interest <interest-bounces+alexander.blasche=qt...@qt-project.org> on 
>> behalf of Roman Wüger <roman.wue...@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@qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>> _______________________________________________
>> Interest mailing list
>> Interest@qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
> 
> _______________________________________________
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to