-
Notifications
You must be signed in to change notification settings - Fork 554
monitor.monitorCharacteristicForDevice callback stuck and not working at all #1299
Copy link
Copy link
Open
Labels
Description
Prerequisites
- I checked the documentation and FAQ without finding a solution
- I checked to make sure that this issue has not already been filed
- I'm sure that question is related to the library itself and not Bluetooth Low Energy or Classic in general. If that so, please post your question on StackOverflow.
- I'm running the latest version
Question
device is already connected and discovered, but somehow the monitorCharacteristicForDevice callback not firing at all and im just stuck without response. I'm currently using react-native 0.73.9 with react-native-ble-plx 3.5.0
Is there anything that I did wrong? thank you in advance
Question related code
manager.startDeviceScan(null, null, (error, device) => {
if (error) {
// Handle error (scanning will be stopped automatically)
setState({
isSyncing: false,
});
return;
}
console.log(device?.name);
// Check if it is a device you are looking for based on advertisement data
// or other criteria.
if (device && device.name && device.name.includes("WeLock")) {
// Stop scanning as it's not necessary if you are scanning for one device.
console.log("found welock device", device.name);
manager.stopDeviceScan();
manager
.connectToDevice(device.id)
.then((device) => {
console.log("device connected", device);
return device.discoverAllServicesAndCharacteristics();
})
.then((device) => {
console.log("monitor...", device.id);
// Once connected, read the specific characteristic value
manager.monitorCharacteristicForDevice(
device.id,
SERVICE_UUID,
NOTIFY_CHARACTER,
(err, characteristic) => {
console.log({ err, characteristic });
}
);Reactions are currently unavailable