Android Question Target SDK 31 and Bluetooth

gerardguerin

Member
Licensed User
Longtime User
I have an application that uses BLE2 and SDK 30, everything is fine, until I want to update on the Google Play Store, because it asks for SDK31 and I have this error:

Error:
Error occurred on line: 93 (Bluetooth)
java.lang.SecurityException: Need android.permission.BLUETOOTH_SCAN permission for AttributionSource { uid = 10592, packageName = com.volthium.monitor, attributionTag = null, token = android.os.BinderProxy@535d615, next = null }: GattService registerScanner
    at android.os.Parcel.createExceptionOrNull(Parcel.java:2437)
    at android.os.Parcel.createException(Parcel.java:2421)
    at android.os.Parcel.readException(Parcel.java:2404)
    at android.os.Parcel.readException(Parcel.java:2346)
    at android.bluetooth.IBluetoothGatt$Stub$Proxy.registerScanner(IBluetoothGatt.java:1886)
    at android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper.startRegistration(BluetoothLeScanner.java:519)
    at android.bluetooth.le.BluetoothLeScanner.startScan(BluetoothLeScanner.java:305)
    at android.bluetooth.le.BluetoothLeScanner.startScan(BluetoothLeScanner.java:161)
    at android.bluetooth.BluetoothAdapter.startLeScan(BluetoothAdapter.java:6229)
    at android.bluetooth.BluetoothAdapter.startLeScan(BluetoothAdapter.java:6131)
    at anywheresoftware.b4a.objects.BleManager2.Scan2(BleManager2.java:156)
    at com.volthium.monitor.bluetooth$ResumableSub_StartScan.resume(bluetooth.java:1019)
    at com.volthium.monitor.bluetooth._startscan(bluetooth.java:974)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
    at anywheresoftware.b4a.BA$2.run(BA.java:387)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at android.app.ActivityThread.main(ActivityThread.java:8669)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
 
Top