This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BLUETOOTH_PRIVILEGED error HID keyboard

Hi all, I have compiled the ble_app_hids_keyboard example for a nRF52832 on a Laird DVK-BL652 breakout board. I have a tablet running android 5.1.1 and the nordic nRFConnect tool. I find that I can connect the nRFconnect app to the device and I can get notifications from the battery service.

I find that if I try to get notifications or read from the HID characteristics the connection closes and I get an error message saying: Need BLUETOOTH_PRIVILEGED permission.

As I understand it this is related to the devices automatically paring without user intervention, and you cannot set this permission inside your own Android app.

Does anyone know how to access the HID data without causing this error?

Parents
  • Hi,

    You are right, this is to prevent 3rd party apps from using this service. Only apps having BLUETOOTH_PRIVILEGED permission (that is those signed with Google's key, so Settings, Android system itself, etc.) can access characteristics and descriptors in this service. It is not possible to do any walk-around. If you need to add some additional features to your keyboard, you have to use a different, custom service, that only your app will be able to understand. You may have HID and other services on one device. System will use the HID service, your app others.

    This permission is required since Android 5 onward. Before Lollipop, it was possible for any app to enable notifications on HID Report characteristic and listen to any keys (passwords!) typed in. Starting from 5 it is guaranteed that only the system will receive sensitive data typed by the user and it will send them to the correct app as keys, not as BLE events.

    Please, read more here: devzone.nordicsemi.com/.../ in 4.6.

    Best Regards, Aleksander

  • i am also facing same issue so how we can check this for app and enable the notification to get the report 

Reply Children
Related