zebra-technologies / Scanner-SDK-for-Android

The Zebra Scanner SDK for Android enables cordless scanners to be connected and controlled by a tablet / smart phone without using a cradle, after pairing over Bluetooth.
https://www.zebra.com/us/en/support-downloads/software/developer-tools/scanner-sdk-for-android.html
MIT License
41 stars 17 forks source link

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

Open Halfpint-Code opened 1 year ago

Halfpint-Code commented 1 year ago

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)

sproctor commented 1 year ago

You need to update to 2.6.10 or 2.6.13

Riadzebra commented 1 year ago

This is new permission required in android api 33. In (v2.6.13.0) release we added api33 support which addresses this. latest (v2.6.16.0) release posted in the link https://www.zebra.com/us/en/support-downloads/software/developer-tools/scanner-sdk-for-android.html Release note https://www.zebra.com/content/dam/zebra_new_ia/en-us/software/developer-tools/scanner-sdk-android/release-notes-android-sdk.pdf