I'm trying to scan the beacons nearby in react native application.
For that I used react-native-ble-plx library
https://github.com/dotintent/react-native-ble-plx
I simulated a beacon using this windows app
https://www.microsoft.com/en-lk/p/beacon-simulator/9nblggh4xvd0?activetab=pivot:overviewtab
I tested my simulated beacon using ble scanner apps and detected my simulated beacon successfully.
But the issue is I cannot get it to detect with the use of react-native-ble-plx in my react native application.
It actually shows several devices nearby but it does not show the UUID or name. These data are shown as null.
For example:
'device', { serviceUUIDs: null,
isConnectable: null,
overflowServiceUUIDs: null,
txPowerLevel: null,
serviceData: null,
manufacturerData: 'TEACFCd6h5jcoxKqh9ACQqwTAAOBqZYcxQ==',
name: null,
mtu: 23,
rssi: -47,
solicitedServiceUUIDs: null,
localName: null,
id: '32:BD:32:6C:E9:C2',
But when I used a real device like a bluetooth headset or similar, then it will get detected properly with showing its name , uuid etc.
Why can't I get my simulated beacon to show up in my react native app when scanned.
FYI : i'm using a real device to do the scanning. (Samsung S10 - Android 11)
This is my code
I have a button as follows
<Button title="Scan devices" onPress={scanDevices} />
and my function
const scanDevices = () => {
setIsLoading(true);
// scan devices
manager.startDeviceScan(null, null, (error, scannedDevice) => {
if (error) {
console.warn(error);
}
// if a device is detected add the device to the list by dispatching the action into the reducer
if (scannedDevice) {
console.log('device', scannedDevice);
dispatch({ type: 'ADD_DEVICE', payload: scannedDevice });
}
});
// stop scanning devices after 5 seconds
setTimeout(() => {
manager.stopDeviceScan();
setIsLoading(false);
}, 55000);
};
Note that I'm new to ble technology and wondering whether I missed something here.