Error when pairing bluetooth device

2

I have been developing an application for a long time and I was working with Bluetooth printing until the mobile software was updated, it started to slow down the connection after the phone's 6.0 Marshmallow update, then it did not connect to the first one if not that I had to give it several times until I succeeded and now it does not connect; I get the following error:

  

java.lang.SecurityException: Need BLUETOOTH PRIVILEGED permission:   Neither user 10218 nor current process has   android.permission.BLUETOOTH_PRIVILEGED.

Permissions are well declared in the Manifest:

<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED"/>
...
...
...

I have searched a lot and I really do not know what to do. I appreciate the help you can give me, I'm going crazy ... The Bluetooth turns on, finds the necessary device but at the time of matching

mmDevice.setPairingConfirmation(true);

I get the error. As I said before, it worked very well until the mobile software was updated now it's Android 7.0 Nougat.

    
asked by Daosgu 11.12.2017 в 14:33
source

1 answer

0

In this case, both applications must have permission BLUETOOTH_PRIVILEGED

  

BLUETOOTH_PRIVILEGED Allows applications to match   Bluetooth devices without user interaction, and allows or not   access to the address book or access to messages. NOT available for third-party applications.

But in order to assign this permission your application must be configured as a system application , if your application is not a system application, even if you have the permissions configured, they can not be assigned:

  

Java.lang.SecurityException: Need BLUETOOTH PRIVILEGED permission:   Neither user 10218 nor current process has   android.permission.BLUETOOTH_PRIVILEGED.

I suggest this article:

HOW TO CONVERT AN ANDROID APPLICATION IN A SYSTEM APPLICATION

Convert any App to Android Root System Application

    
answered by 11.12.2017 в 18:25