couldn't detect nearby bluetooth device
See original GitHub issueHi 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:
- Created 6 years ago
- Comments:26 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 ?
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.