question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Device is not connected

See original GitHub issue

Version

Tell us which versions you are using:

  • react-native-ble-manager v.6.5.6
  • react-native v.0.57.8
  • Android v.27.0.3

Expected behavior

When trying to connect to VEEPEAK OBD 2 dongle and call retrieveServices method it should give all the services PIDs and characteristics.

Actual behavior

When I am trying to connect my react native app to the VEEPEAK OBD2 dongle it gets connected but within a second it gets disconnected. Before connecting I am also creating a bond with the device. The bond created successfully but still after getting connected it gets disconnected. Previously I was using the v.6.5.4 of the library that time also it is giving the same behavior and after upgrading to the latest v.6.5.6 still the things are same for me. The device I am trying to connect is a Veepeak OBDCheck BLE OBD2 Bluetooth Scanner which works on Bluetooth 4.0, link for this device is: https://www.amazon.com/Veepeak-OBDCheck-Bluetooth-Diagnostic-Compatible-x/dp/B073XKQQQW

Also please check the code below: BleManager.createBond(peripheral.id).then(() => { console.log('createBond success or there is already an existing one'); BleManager.connect(peripheral.id).then(() => { let peripherals = this.state.peripherals; let p = peripherals.get(peripheral.id); if (p) { p.connected = true; peripherals.set(peripheral.id, p); this.setState({ peripherals }); } console.log('Connected to ' + peripheral.id); setTimeout(() => { BleManager.retrieveServices(peripheral.id).then((peripheralData) => { console.log('Retrieved peripheral services', peripheralData); setTimeout(() => { BleManager.read(peripheral.id, serviceUUID, characteristicUUID).then((readData) => { console.log('Read: ' + readData); }).catch((error) => { console.log(error); }); }); }).catch((error) => { console.log('Error: ' + error); }); }); }).catch((error) => { console.log(error); }); }).catch(() => { console.log('fail to bond'); })

Steps to reproduce

  1. Scan for peripherals
  2. List all peripherals
  3. Create a bond with the peripheral
  4. Connect to the peripheral
  5. Retrieve services of the peripheral

Stack trace and console log

Create bond success or there is already an existing one Connected to 8C:XX:XX:XX:XX:CD Disconnected to to 8C:XX:XX:XX:XX:CD Error: Device is not connected

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
maartenvandillencommented, Dec 21, 2021

I have the same problem. It starts at random after some app runs. I suspect it has something to do with the underlying Bluetooth layer of Android. It gets really weird when I completely disable Bluetooth from the phone settings, the connection still exists and I can still operate my peripheral. Even after killing my app I can still connect to it while Bluetooth is turned off. I suspect this connection keeps existing even after the app is restarted. Only rebooting my phone (Samsung Galaxy S20+) solves this.

0reactions
maartenvandillencommented, Sep 29, 2022

I got it all working now, the library works fine. When React Native hot reloads the app the connection persists so then it gets confused. Solved by disabling Bluetooth from the phone settings menu (not from the quick pull system down menu, that button is pure evil on Samsung devices) to disconnect the device.

If you device reports isConnectable false then there may already be a current connection or maybe something is wrong in the firmware.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Currently, This Hardware Device is Not Connected to The ...
1. Perform a DISM scan · 2. Update the drivers · 3. Run Windows Update · 4. Repair PC Registry · 5. Uninstall...
Read more >
8 Fixes to Hardware Device Is Not Connected to the Computer ...
Step 1. Type “troubleshooting” in the search box > Click the Troubleshooting option. Step 2. Troubleshooting windows will appear and click Hardware and...
Read more >
Error Code 45 on Device Manager for Intel® Bluetooth® or...
Per Microsoft's website, Error Code 45 occurs if a device that was previously connected to the computer is no longer connected. Microsoft's recommendation...
Read more >
Error code 45 hardware device is not connected
This error occurs if a device that was previously connected to the computer is no longer connected. To resolve this problem, reconnect this ......
Read more >
Error Code 45 in Device Manager [SOLVED] - Driver Easy
When the error message says your hardware device is not connected to the computer, chances are your device driver is missing or corrupted....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found