rusel1989 / react-native-bluetooth-serial

Port of https://github.com/don/BluetoothSerial for react native
475 stars 291 forks source link

Cannot connect to device #118

Open ShashwatMDas opened 4 years ago

ShashwatMDas commented 4 years ago

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?

diarynar commented 4 years ago

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

NChandan commented 3 years ago

Same with me. Is there any solution?

aftabGalaxy commented 2 years ago

Same with me. Is there any solution?

@rusel1989 Please help us to resolve this?

shadahmad7 commented 2 years ago

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

shadahmad7 commented 2 years ago

just send device id

joseph2000k commented 12 months ago

any update here?