Skip to content

Endless scanning sometimes. #693

@priyanka-Sadh

Description

@priyanka-Sadh

Using following version
"react-native": "0.62.2",
"react-native-ble-plx": "^1.1.1",
I want to know reason of below scenario:

When Mobile app is in connected status with ble device,
and I turn off the device app goes to disconnected mode and re-scan and then connect. (I repeat this)
It happens regular 2-3 time successfully, after this sometime app goes to endless scanning (Scanning...) mode so in this case I have to kill and re-launch the app.

And sometime (after 2-3 time) it continuously says BleError : can not start scanning operation
so in this case I have to kill and re-launch the app or need to again turn-off or turn on the device.

My code below
this.manager.startDeviceScan(null,{ScanMode : "Balanced" }, (error, device) => { console.log("Scanning..."); if (null) { console.log('null'); return; } if (error) { console.log("Error in scan=> "+error) this.scanAndConnect() return } if(device.name == 'mydevice'){ this.manager.connectToDevice(device.id, {autoConnect:true}).then((device) => { (async () => { //listener for disconnection device.onDisconnected((error, disconnectedDevice) => { console.log('Disconnected ', disconnectedDevice.name); this.scanAndConnect(); // to start scanning again }); })(); }); } })

may I know the reason or any mistake if I made here in code ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions