react-native-ble-plx icon indicating copy to clipboard operation
react-native-ble-plx copied to clipboard

Some devices get write fails (Android)

Open sweebee opened this issue 4 years ago • 7 comments

We are using this package in an app with around 300 users. These users have to setup a BLE device. But some (only android) users (10?) just keep getting this error (logged with Bugsnag):

BleError: Characteristic 00004e03-0000-1000-8000-00805f9b34fb write failed for device 84:DF:0C:10:2C:AB and service 00004e01-0000-1000-8000-00805f9b34fb

I'm unable to track this with any local devices we have, but what could this be? Is it an issue with this package? The BLE device? or a specific android version?

sweebee avatar Feb 22 '21 10:02 sweebee

@sweebee Did you check characteristics ? Try this if you did not.

const services = await device.services(); const characteristics0 = await services[0].characteristics(); const characteristics1 = await services[1].characteristics(); const characteristics2 = await services[2].characteristics(); console.log('Characteristics0: ', characteristics0); console.log('Characteristics1: ', characteristics1); console.log('Characteristics2: ', characteristics2);

ayberkgerey avatar Feb 24 '21 12:02 ayberkgerey

@ayberkgerey yes this way:

    await this.connectedDevice.discoverAllServicesAndCharacteristics();
    const services = await this.connectedDevice.services();
    this.characteristics = [];
    for await (const service of services) {
      const characteristics = await service.characteristics();
      for await (const characteristic of characteristics) {
        this.characteristics.push(characteristic)
      }
    }

sweebee avatar Feb 24 '21 13:02 sweebee

I received device info from 2 customers that are using the app, they were both using a Samsung Galaxy S10 with Android 11.

sweebee avatar Feb 24 '21 14:02 sweebee

@sweebee My project has to work over anroid 5.

ayberkgerey avatar Feb 25 '21 09:02 ayberkgerey

I am having the same issue but only seems to happen when i am plugged in with a usb cable to a computer with file transfer unabled on the device?? Using a Oneplus 7 Pro on Android 10. Also only seems to happen on the release version and not on the Debug (dev) version.

Lacni135 avatar Apr 22 '21 19:04 Lacni135

I'm seeing a similar error on Galaxy Note 10. Has anyone found a solution?

tlechman49 avatar Aug 20 '21 16:08 tlechman49

Found a workaround to this solution: Add a slight delay before writing to the BLE device, I used a 50ms delay before writing anything to the BLE device to solve this issue.

JJSLIoT avatar Aug 17 '22 12:08 JJSLIoT

I'm excited to inform you that we've released a new version of react-native-ble-plx. Many of the concerns and bugs have been addressed in this update.

If you encounter any issues or have further suggestions, please don't hesitate to open a new issue.

abursztynowska avatar Oct 06 '23 08:10 abursztynowska