I am trying to write an app for Android P using the Bluetooth HID device profile service to be used as a Bluetooth keyboard. According to the documentation I am supposed to use the method BluetoothAdapter.getProfileProxy(Context, BluetoothProfile.ServiceListener, int)
to get the BluetoothHidDevice proxy object.
During debug on my Android Pie device (Nokia 7 plus) the service listener never get called (onServiceConnected
), and i get the following error in Logcat:
Could not bind to Bluetooth HID Device Service with Intent { act=android.bluetooth.IBluetoothHidDevice }
If I change the last param in the call above from HID_DEVICE to some other bluetooth profile e.g. A2DP, the service listener get the callback onServiceConnected
and no error is displayed.
BluetoothHidDevice
be used to create a hid-device on an Android
Pie phone?getPackageManager().hasSystemFeature
)
missing in my phone?Any hints would be greatly appreciated :)
This seems to be a third-party issue. Nokia did not enable the hid-profile in Android Pie. I also tried with a Mototorola G7 play, it was also disabled, i guess it's time for a pixel...
Currently on pixel the HID device Profile is enabled . Nokia, moto(as mentioned above) and One Plus 5T and 6 as far as i know dont support this profile.
We have created an app which lets you use your phone as a bluetooth mouse and keyboard with this HID device profile. https://play.google.com/store/apps/details?id=com.github.roarappstudio.btkontroller
The code is open sourced at https://github.com/raghavk92/Kontroller. If anyone wants to help in making improvements or contribute to the code they are welcome.
You can also check if your phone supports Bluetooth HID device profile with the app - https://play.google.com/store/apps/details?id=com.rkaneapplabs.bluetooth_hid.bluetoothproxy and let your device manufacturer know if they dont support your device because its part of android pie and should be supported.
List of devices that have the Bluetooth HID device profile activated/Not Working(due to manufacturer implementation bugs) is here - https://github.com/raghavk92/Android_Bluetooth_HID_Device_Profile_CompatibilityList
The bugs are due to implementation on the manufacturer's side not google as pixel devices support this Bluetooth HID device profile since android pie