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.

couldn't detect nearby bluetooth device

See original GitHub issue

Hi i couldn’t get nearby device even the bluetooth is turn on in other device. `constructor(props) { super(props); this.state = { text: ‘’}; this.manager = new BleManager(); this.scan = this.scan.bind(this); this.error = this.error.bind(this); this.scanAndConnect = this.scanAndConnect.bind(this); }

scanAndConnect() { this.manager.startDeviceScan(null, null, (error, device) => { console.log(error); console.log(device); }) }

componentWillMount() { const subscription = this.manager.onStateChange((state) => { if (state === ‘PoweredOn’) { this.scanAndConnect(); subscription.remove(); } }, true); }`

Scan and connect should provide me the nearby device.but doesn’t show anything…i tried multiple times.no luck.Also i am testing in real device.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:26 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
taj567commented, Nov 26, 2021

const scanDevices = async () => { const btState = await manager.state() console.log(btState,“btstate scandevices”) if (btState!==“PoweredOn”) { alert(“Bluetooth is not powered on”); return (false); } const permission = await requestPermission(); console.log(permission,“permission”) if (permission) { manager.startDeviceScan(null, null, async (error, device) => { if (error) { console.log(error); return } if (device) { console.log(device) // console.log(${device.name} (${device.id})}); const newScannedDevices = scannedDevices; newScannedDevices[device.id] = device; await setDeviceCount(Object.keys(newScannedDevices).length); await setScannedDevices(scannedDevices); } }) } }

using react-native-ble-plx not detecting all nearby devices ?

1reaction
Cierpliwycommented, Jun 7, 2017

Devices using BLE work in one of two modes: Central (which this library allows) and Peripheral. In most of use cases applications on your phone implement Central mode which allows them to properly scan, connect to and communicate with devices. This is normal flow.

There is also possibility to create and application in Peripheral mode on iOS and newest Androids. This is not supported by this library, your iPhone/Android by itself won’t start working as Peripheral. You need to create/install application which does just that. When it is running, it advertises itself as a specific BLE device and may allow one Central to connect to it.

I recommend that your read more about how BLE works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Bluetooth Pairing Problems - Techlicious
1. Make sure Bluetooth is turned on · 2. Determine which pairing process your device employs · 3. Turn on discoverable mode ·...
Read more >
Fix Bluetooth problems on Android - Google Support
Step 1: Check Bluetooth basics · Turn Bluetooth off and then on again. Learn how to turn Bluetooth on and off. · Confirm...
Read more >
Why Won't My Bluetooth Connect? How to Fix Common Issues
If your Bluetooth devices won't connect, it's likely because the devices are out of range, or aren't in pairing mode.
Read more >
Fix Bluetooth problems in Windows - Microsoft Support
Learn how to troubleshoot Bluetooth problems in Windows. Resolve issues connecting a Bluetooth device or accessory.
Read more >
Unable to discover Bluetooth devices when ... - Lenovo Support
Right-click the Bluetooth icon present on the notification center of the taskbar. Select Open Settings. Select More Bluetooth options. Check Allow Bluetooth ......
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