I am using react-native-ble-plx for implementing bluetooth in my app
The bluetooth scanning works fine but it contains duplicates in android whereas it works fine in iOS since allowDuplicates is default false in iOS.
In android the default is true. Please provide as solution to filter out the duplicates using the allowDuplicates property of react-native-ble-plx
Syntax for startDeviceScan from documentation:-
bleManager.startDeviceScan(
UUIDs: ?Array<UUID>,
options: ?ScanOptions,
listener: (error: ?Error, scannedDevice: ?Device) => void
)
https://github.com/Polidea/react-native-ble-plx/wiki/Bluetooth-Scanning
My code:-
this.manager.startDeviceScan(null, {allowDuplicates:false}, (error, device) => {
//2nd parameter is scanOptions
if (error) {
// Handle error (scanning will be stopped automatically)
return
}
this.state.count++
if(this.state.count>10)
{
this.manager.stopDeviceScan();
}
console.log("id",device.id)
}
please tell if any syntax error persists