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
39 stars 16 forks source link

Connection via BLE fails if some other BLE devices are connected to the phone #3

Open ov1d1u opened 2 years ago

ov1d1u commented 2 years ago

I have an Amazfit Verge Lite watch which is always connected to my phone and because of it I can't connect with the scanner. Seems that this happens because of this line in BluetoothLEManager:

if (this.mBluetoothManager.getConnectedDevices(7).size() > 0) {
    ....

where getConnectedDevices(7) is returning a list containing my watch which means that it satisfy the condition.

This also happens with the SDK demo app.

Riadzebra commented 1 year ago

Could you try testing using SSI BT Classic mode instead of BLE ?

ov1d1u commented 7 months ago

It works with SSI over Bluetooth classic, but this is not an acceptable solution since we're working with users that are not tech savvy so we can't ask them to get and fill a BT address somewhere in our app.

From your code I see that you're doing this:

if (this.mBluetoothManager.getConnectedDevices(7).size() > 0) {
    connectedDevice = (BluetoothDevice)this.mBluetoothManager.getConnectedDevices(7).get(0);
    DebugConfig.logAsMessage(DEBUG_TYPE.TYPE_DEBUG, "BluetoothLEManager", "ScanCallback: onScanResult  Device already connected " + connectedDevice.getName());
}

It seems that the issue lies in this.mBluetoothManager.getConnectedDevices(7).get(0), is there any guarantee that this will return our Zebra scanner if there are multiple BLE devices connected to the phone?