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.
- Has anyone created a working HID_DEVICE on Android Pie?
- Can
BluetoothHidDevice
be used to create a hid-device on an Android Pie phone? - Is there any working code that i can look at?
- Is there some feature (
getPackageManager().hasSystemFeature
) missing in my phone? - What could be the reason for the error above?
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...
android:enabled="@bool/profile_supported_hidd"
and the bool set to false). I fixed it withsetComponentEnabledSetting
– Dahliadahlstrom