Android - opening connection with a printer after bluetooth searching is not working

// Expert user has replied.
M Matac Stefan 7 months 3 weeks ago
265 4 0

Hello,

I have a problem using Link-OS SDK Android BTLE v2.14.5198.

Many years ago I developed a feature on an app from which you can print using ZQ521 Zebra printers.

Everything went well but recently a problem occured.

After using BluetoothLeDiscoverer.findPrinters to search for a printer, after I create BluetoothLeConnection with the MAC Address from the printer found by findPrinters method, when I call open() on connection, I get this exception: Could not connect to device: Bluetooth LE Gatt failed to Connect. 

This error happens only for LE mode, on CLASSIC mode seems to be everything ok.

The weird thing is that if I restart the device and I try to open the connection with the previous found MAC Address, without using findPrinters, everything works well. But if I try to search bluetooth devices, even from Android Settings and I come back to the app, when it tries to open de connection, it fails again with that error. It will work again only if I restart the device.

It seems that searching for bluetooth  devices breaks something on open connection. Maybe I do something wrong but this app worked well in the past and this issue doesn't seem to be from the app.

I tested this on Zebra ET56 tablet and on a Samsung A12, both having the same problem.

Thank you.

 

Please Register or Login to post a reply

4 Replies

S Steven Si

What's the Android version on the ET56 and the Samsung A12 devices that have this issue? Maybe the new Android version breaks something.

M Matac Stefan

Hello,

ET56 has Android 11 and Samsung A12 has Android 13. 

S Steven Si

Hi Matac,

I've just tested the ZSDK_DemosAndroid_BTLE demo app that comes with the release package of the Link-OS SDK for Android BTLE SDK v2.14.5198 on a ET56 Android 11 tablet. I do not see any exception after discovering BLE and then opening the connection. The Connectivity sub-demo has the BTLE discovery and then makes the connection immediately after clocking on the corresponding MAC address of the printer. See the screenshot below.

Please make sure that the android.permission.ACCESS_FINE_LOCATION is requested and granted. The printer's BTLE also needs to be enabled with the following SGD or via the Printer Setup app.

### Verify the BTLE setting
! U1 getvar "bluetooth.le.controller_mode"

### Configure the BTLE setting with the "le" or "both" for BTLE.
! U1 setvar "bluetooth.le.controller_mode" "both"

DevDemo_BTLE_1DevDemo_BTLE

 If the issue still persists, please share a the source code of a test app, so that we can reproduce and debug at our end.

G Giorgio Zett

same issue here.

It seems I can connect to the printer, but I can't print at all.

Is there any way to force to use the Classic Bluetooth mode? I guess in some way it's using the BLE mode...

I hope in this way to be able to print again

I have done some customisations in the RNZebraBluetoothPrinterModule class (by npm patch) and I can easily update the code in the npm module. I'm trying to fix it, but it seems I'm not able to find out a working solution

thanks a lot! 

CONTACT
Can’t find what you’re looking for?