Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect device #13

Open
CorentinHeroux opened this issue Aug 30, 2021 · 6 comments
Open

Unable to connect device #13

CorentinHeroux opened this issue Aug 30, 2021 · 6 comments

Comments

@CorentinHeroux
Copy link

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

@anmoljain10
Copy link
Contributor

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

@CorentinHeroux
Copy link
Author

Yes

@timnode
Copy link

timnode commented Sep 14, 2021

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
Copy link

timnode commented Sep 15, 2021

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)

@shivamb-private
Copy link

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

@timnode
Copy link

timnode commented Sep 18, 2021

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants