react-native-ble-plx: [Android] Can't monitor a characteristic

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Expected Behavior

I expect, as the documentation says, that if the characteristic is notifiable, I can monitor it to be informed whenever the value of the characteristic has changed.

Current Behavior

My characteristic can’t be monitored although the notifiable value is true. I’m having exactly the same problem on iOS and Android.

When I try to monitor the characteristic, I directly receive the following BleError : Characteristic 2456e1b9-26e2-8f83-e744-f34f01e9d703 notify change failed for device X and service 2456e1b9-26e2-8f83-e744-f34f01e9d701

I checked the following links, try the propositions, but any of them helps me to resolve it :

But, while reading this wiki pages, I found two conflicting informations. In the Characteristic Notifying page, it’s written :

There is no need to write Client Characteristic Configuration descriptor at all. It is handled by the library/OS.

And in the I got a BleError. Now what?, I found the opposite :

(iOS) Notifications emit error but it works using different tools BleError: Characteristic X notify change failed for device ? and service Z Most probably the device you are using is not conforming to the Core Bluetooth Specification and the Characteristic you try to monitor does not have a Client Characteristic Configuration descriptor.

So, why it is needed that the characteristic have one descriptor if, as said, it’s handled by the library/OS ?

For your information, I’m using a BLE uBlox component, and if I try to monitor the characteristic with the u-blox BLE App, it’s working. (Android/iOS) That means the peripheral is notifiable and properly working.

Context

  • Library version: 2.0.0
  • Platform: Android/iOS.
device.connect()
        .then(() => {
          console.log('Connected to device');
          console.log('Discovering services and characteristics ...');
          return super.discoverAllServicesAndCharacteristics();
        })
        .then(() => {
          console.log('Services and characteristics discovered');
          console.log('Looking for FIFO characteristic...');
          super
            .characteristicsForService(SERVICE_UUID)
            .then(characteristics => {
              const fifoCharacteristic = this.getFifoCharacteristic(characteristics);
              console.log('Start listening FIFO characteristic ...');
              fifoCharacteristic.monitor((error, char) => {
                console.log(error);
                console.log(char.value);
              });
            });
        })
        .catch(error => {
          console.log(error);
        });

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 44

Most upvoted comments

I had the same problem and managed to solve it with using bleManager.monitorCharacteristicForDevice(device.id, service, charName, (error, characteristic) => { ... } instead of device.monitorCharacteristicForService(service, charName, (error, characteristic) => { ... }