I have simulated a beacon from computer and i'm trying to read beacon info (uuid,identifier etc) from my react native app.
I decided to use this library https://github.com/dotintent/react-native-ble-plx as the library.
The issue i'm facing is although it shows some devices when i scan, the name,uuid and other info shows as null.
For ex:
'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',
And this is my code
const bluetoothInstance = new BleManager();
const scanAndConnect = () => {
bluetoothInstance.startDeviceScan(null, { allowDuplicates: true }, (error, device) => {
console.log('device', device);
console.log('error', error);
if (error) {
// Handle error (scanning will be stopped automatically)
return;
}
if (device?.name === 'MyProjectName') {
bluetoothInstance.stopDeviceScan();
} else {
// bluetoothInstance.stopDeviceScan();
}
});
};
useEffect(() => {
bluetoothInstance.onStateChange((state) => {
console.log('state', state);
if (state === 'PoweredOn') {
scanAndConnect();
}
}, true);
}, []);
How i can read the beacon uuid and name? Is there any other library you can recommend? Or is there something missing in the code? Any help would be appreciated.