Skip to content

Is there a fix for Android 12 Bluetooth permissions issue #6

@Halfpint-Code

Description

@Halfpint-Code

We had to update our app to support api 31 required for Google Play updates and we have clients complaining that the app is crashing. I was able to replicate with Android 12. Appears to be an issue with more explicitly calling out requests for BLUETOOTH_CONNECT and BLUETOOTH_SCAN. I'm looking into a work around so our clients can get back online. I'm hoping I don't have to remove the scanner library because we have a client looking at testing some Zebra Bluetooth scanners right now.

When I add the request for BLUETOOTH permissions, it asks but our app still crashes with the error below. It will run after the initial crash but that result is undesirable right now.

2022-11-23 15:25:33.513 7257-7667/com.xxxx.xxxx E/ACRA: ACRA caught a SecurityException for com.xxxx.xxxx
java.lang.SecurityException: Need android.permission.BLUETOOTH_CONNECT permission for AttributionSource { uid = 10296, packageName = com.xxxx.xxxx, attributionTag = null, token = android.os.BinderProxy@651ddb6, next = null }: getAddress
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.IBluetoothManager$Stub$Proxy.getAddress(IBluetoothManager.java:1165)
at android.bluetooth.BluetoothAdapter.getAddress(BluetoothAdapter.java:2333)
at android.bluetooth.BluetoothSocket.(BluetoothSocket.java:266)
at android.bluetooth.BluetoothSocket.(BluetoothSocket.java:216)
at android.bluetooth.BluetoothServerSocket.(BluetoothServerSocket.java:148)
at android.bluetooth.BluetoothAdapter.createNewRfcommSocketAndRecord(BluetoothAdapter.java:4125)
at android.bluetooth.BluetoothAdapter.listenUsingRfcommWithServiceRecord(BluetoothAdapter.java:4030)
at com.zebra.scannercontrol.BluetoothManager$AcceptThread.run(BluetoothManager.java:415)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions