react-native-bluetooth-serial icon indicating copy to clipboard operation
react-native-bluetooth-serial copied to clipboard

Cannot connect to device

Open ShashwatMDas opened this issue 5 years ago • 6 comments

I get this error whenever I try to connect a bluetooth device via my react native app:

Error: read failed, socket might closed or timeout, read ret: -1 Unable to connect to device

Here's what I'm trying to do: connectToDevice () { if (this.state.discovering) { return false } else { this.setState({ discovering: true }) console.log("searching"); BluetoothSerial.list() .then((Devices) => { this.setState({ Devices, discovering: false }) for(var i = 0; 1; i++) { if(Devices[i]["name"] == "JBL Flip 3 SE") { console.log(Devices[i]["id"]); BluetoothSerial.connect(Devices[i]["id"]).then((res) => { console.log(res); }).catch(err => { console.log(err); }) break; } } // console.log(unpairedDevices); }) .catch((err) => console.log(err.message)) } }

Same happens even when I clone the example repo.

Any idea why this is happening?

ShashwatMDas avatar May 01 '20 17:05 ShashwatMDas

It's all the same to me. Is there anyone we can help us with? Please!

diarynar avatar Aug 10 '20 02:08 diarynar

Same with me. Is there any solution?

NChandan avatar Sep 28 '20 08:09 NChandan

Same with me. Is there any solution?

@rusel1989 Please help us to resolve this?

aftabGalaxy avatar Sep 13 '21 13:09 aftabGalaxy

Use react-native-bluetooth-devices to connect with device

shadahmad7 avatar May 05 '22 12:05 shadahmad7

just send device id

shadahmad7 avatar May 05 '22 12:05 shadahmad7

any update here?

joseph2000k avatar Sep 11 '23 03:09 joseph2000k