java.lang.SecurityException: Need BLUETOOTH PRIVILEGED permission

前端 未结 5 2209
天涯浪人
天涯浪人 2021-02-19 22:12

Has anyone meet the same problem as the following error message shows when calling bluetoothDeive.createBond() method with android 4.4 api?

j

5条回答
  •  我寻月下人不归
    2021-02-19 22:35

    Try this:

    1) remove "android.permission.BLUETOOTH_PRIVILEGED" from your permissions.
    2) remove "android.permission.BLUETOOTH".
    3) add "android.permission.BLUETOOTH_ADMIN" and just that.

    The reference says that is the only permission needed.https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#createBond()

    EDIT: if you already included "bluetooth_admin", maybe its a platform problem.They may have not supported that functionality earlier. Maybe you should target a higher min-sdk-platform , Im using Android 20 as the minimum (but never tried that function).

提交回复
热议问题