GeekyAnts / react-native-zebra-bluetooth-printer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to connect device

CorentinHeroux opened this issue · comments

This code always returns "Unable to connect device" no matter what device is used (Android 5, 8, 10).
The address sent is the correct one (returned by pairedDevices()).
Zebra ZD421 printer

let deviceAddress = '00:07:4D:BD:27:2E';
RNZebraBluetoothPrinter.connectDevice(deviceAddress)
    .then((res) => { 
        console.log(res);
    })
    .catch((error) => console.log(error.message));

Has anyone experienced this problem or seen how to solve it ? Thanks

@CorentinHeroux , is it happening in both Android and iOS?

I think I have the same problem. My device is ZD420.

I can find the address from paired list, but receive "Unable to connect device" when calling connectDevice.

The error logs in java are below

java.io.IOException: read failed, socket might closed or timeout, read ret: -1
at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:762)
at android.bluetooth.BluetoothSocket.waitSocketSignal(BluetoothSocket.java:715)
at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:404)
at com.zebrabluetoothprinter.BluetoothService$ConnectedThread.run(BluetoothService.java:184)

I found the reason of my problem, it was because connectDevice seemed to not support ZD420 Bluetooth LE. Finally, I solved it by using import com.zebra.sdk.btleComm.BluetoothLeConnection to make connection.

I think I have the same problem. My device is ZD420.

I can find the address from paired list, but receive "Unable to connect device" when calling connectDevice.

The error logs in java are below

java.io.IOException: read failed, socket might closed or timeout, read ret: -1
at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:762)
at android.bluetooth.BluetoothSocket.waitSocketSignal(BluetoothSocket.java:715)
at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:404)
at com.zebrabluetoothprinter.BluetoothService$ConnectedThread.run(BluetoothService.java:184)

@timnode Hey I am trying to connect with the same printer. Can you elaborate on how you went about it? Would really appreciate.

@timnode Hey I am trying to connect with the same printer. Can you elaborate on how you went about it? Would really appreciate.

You may refer to https://github.com/ararog/react-native-zebra-printer/blob/master/android/src/main/java/com/cyclelution/RCTZebraBTPrinter/RCTZebraBTPrinterModule.java