Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 31 2019 14:20
    stonehippo edited #401
  • Jan 31 2019 14:17
    stonehippo opened #401
  • Jan 29 2019 18:49
    leo-tavares closed #400
  • Jan 29 2019 15:39
    leo-tavares edited #400
  • Jan 29 2019 15:37
    leo-tavares edited #400
  • Jan 29 2019 15:33
    leo-tavares edited #400
  • Jan 29 2019 15:31
    leo-tavares edited #400
  • Jan 29 2019 15:31
    leo-tavares opened #400
  • Jan 28 2019 19:17
    paulreimer closed #398
  • Jan 26 2019 19:05
    bhenav edited #399
  • Jan 26 2019 18:34
    bhenav edited #399
  • Jan 26 2019 18:33
    bhenav edited #399
  • Jan 26 2019 18:32
    bhenav edited #399
  • Jan 26 2019 18:25
    bhenav edited #399
  • Jan 26 2019 18:24
    bhenav edited #399
  • Jan 26 2019 18:21
    bhenav edited #399
  • Jan 26 2019 18:20
    bhenav opened #399
  • Jan 26 2019 00:03
    paulreimer opened #398
  • Jan 25 2019 23:46
    paulreimer opened #397
  • Jan 25 2019 23:20
    ChrisEdson opened #396
shalvagelenidze
@shalvagelenidze
Hello. I want to use react-native-nordic-dfu library to update device firmware, this library needs react-native-ble-manager plugin in order to work. I tried this solution Polidea/react-native-ble-plx#260 but I am getting "Could not find device with deviceAddress" error. Just do not get why is this a 'solution' when it does not work and if there is any other solution using this library with react-native-ble-plx ????
3 replies
shalvagelenidze
@shalvagelenidze
@dariuszseweryn hello, could you please tell me how to update the DFU using react-native-nordic-dfu library without implementing react-native-ble-manager
Datagrdn
@Datagrdn
Has anyone had trouble getting accepted to the Google Play Store? I keep getting rejected with the "Prominent disclosure not found" error. I'm calling this from the constructor of our main component but the dialogue isn't popping up before the native dialogue. Seems like a known issue in React. Anyone have solutions specific to this library?
  startBLEActions = async () => {
    try {
      const granted = await PermissionsAndroid.request(
        PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
        {
          title: 'Location Access for Bluetooth Usage',
          message:
            'This app collects location data to enable your PlantWave to pair with your phone even when the app is closed or not in use',
          buttonNeutral: 'Ask Me Later',
          buttonNegative: 'Cancel',
          buttonPositive: 'OK',
        },
      );

      if(this.manager == null){
        this.manager = new BleManager();
        this.manager.setLogLevel('Verbose');
      }

      if (granted === PermissionsAndroid.RESULTS.GRANTED) {
        console.log('You can access location');

        clearInterval(this.findPlantwavesInterval);
        clearInterval(this.flushConnectedListInterval);
        this.findPlantWaves();
        this.flushConnectedList();

        this.findPlantwavesInterval = setInterval(() => this.findPlantWaves(), 7000);
        this.flushConnectedListInterval = setInterval(() => this.flushConnectedList(), 2000);

      } else {
        console.log('Location permission denied');
      }
    } catch (err) {
      console.warn(err);
    }
  };
Datagrdn
@Datagrdn
It seems like the custom message doesn't display when I first open the app. Only if I deny permission on the native dialogue and then re-open
Datagrdn
@Datagrdn
Ah ok, just read that PermissionsAndroid.request() only fires if the user has denied the native permissions dialogue so this is the expected behavior. However, Google's new permissions policy requires a detailed explanation to always show before asking permission. It's preventing me from submitting my app to the Play Store. How are people reconciling this?
mass85
@mass85
Hi. What is "androidErrorCode":133 right after connecting to peripheral? I never have any problems with connecting to that device from nRF Connect, but this tends to happen in JS application using react-native-ble.
26 replies
hamzadahmani
@hamzadahmani
characteristics.monitor((error, result) => {
if (error) {
dispatch(MaintenanceNotifyState(true));
console.log('error', error);
} else {
coldwayParem = coldwayParem.concat(
saveParemetre(decoder(result.value, 'hex'), coldwayParem.length),
);
hello i have problem on ios
cant catch error when remove notify
but its work in android
@dariuszseweryn can u help me
Dayo Akinkuowo
@dayaki
Please what is the best way to format data for writeCharacteristicWithResponseForDevice, the data MUST be base64 encoded?
1 reply
Datagrdn
@Datagrdn
is there a way to discover and connect to a previously paired device without running the whole native dialogue flow? right now a i need to do that each time i pair a device, even if it's already been paired. currently doing it like this:
1 reply
` connect(selectedAddress) {
// might need to pull address from state array for multimode passing it in from radioButton for now
const {availableDevices} = this.state;
this.info('Connecting to PlantWave');
this.manager
  .connectToDevice(selectedAddress)
  .then((device) => {
    this.info('Discovering services and characteristics');
    device.discoverAllServicesAndCharacteristics();
    return device;
  })
  .then((device) => {
    console.log('Negotiating MTU');
    device.requestMTU(300);
    console.log('Setting notifications');`
Priyanka-SP
@Priyanka-SP
Hi all,
I want to display a notification to the user as soon as the device which was connected previously get disconnects either by manually or when its away from the range.
Im using onDisconnected() callback which is totally working fine in ios.but it's taking more than 10 seconds in android
device .connect()
.then((dev) => {
dev.onDisconnected(() => {
const modal = {
name: 'no_sensor',
header: ${dev.name} Disconnected,
buttons: [{ title: 'Ok', isAction: false }],
};
dispatch(triggerAlert(null, modal));
dispatch({
type: DEVICE_UPDATE,
payload: device,
isConnected: false,
isConnecting: false,
});
});
return dev
})
.then((devicewith) => {
dispatch({
type: DEVICE_UPDATE,
payload: devicewith,
isConnected: true,
isConnecting: false,
});
return devicewith.discoverAllServicesAndCharacteristics();
})
1 reply
Priyanka-SP
@Priyanka-SP
@dariuszseweryn how can I listen to 2 notifications at the same time from the same device??
4 replies
Marius Jakobsen
@jakobsen9
Hi! I am not receiving any state changes when listening to onStateChange and turning BT on/off on iOS. Is this a known issue or did I set it up wrong?
  useEffect(() => {
    const subscription = bleManager.onStateChange((state) => {
      console.log('hei');
      setIsBlePoweredOn(state === State.PoweredOn);
      if (state === State.PoweredOn) {
        subscription.remove();
      }
    }, true);
  }, []);
14 replies
Alex
@MasterLambaster
Hello. I have simple question: is it possible to get access for the native manager logs, the ones like [RxBLEKit|DEBG|15:26:22.486]: Peripheral(uuid: ... from the code? I'm fine with file paths or any other way that I can upload that logs from someones device elsewhere to debug issues on the device/peripheral that I don't have access to.
1 reply
Polletto85
@Polletto85

Hi there i have to read all glucose measurement from a ble device. I can read the glucose value from realtime measurement this is my code to write characteristic 0101 for all stored values.
code
async readAll(device) {
const service = this.serviceUUID()
const characteristicW = this.writeUUID()

var myData = '0x0101';
const dataMostSignificantByte = (myData >> 8) & 0xFF;
const dataLeastSignificantByte = myData & 0xFF;

const dataByteArrayInLittleEndian = [dataLeastSignificantByte, dataMostSignificantByte];
const dataInBase64 = Buffer.from(dataByteArrayInLittleEndian).toString('base64');
const write = this.manager.writeCharacteristicWithResponseForDevice(
  device.id,
  service,
  characteristicW,
  dataInBase64,
)
console.log(write)

}
code

11 replies
Wong Xin Wei
@xinweiiiii
Screenshot 2021-01-29 at 10.39.09 PM.png
Hi, i am using an ibeacon and this is my set of code to scan for BLE devices but i am not able to detect the ibeacon.
3 replies
Datagrdn
@Datagrdn
Getting pretty consistent feedback from our users that pairing works with Pixels but not Galaxy. Has anyone come across a similar issue with this library on Galaxy phones?
Bohdan Pomohaibo
@chocky335
@dariuszseweryn How we can get advertising data? It's required to identify the manufacturer of the device.
https://image.slidesharecdn.com/ibeaconworkshop-april2014-140430015502-phpapp01/95/build-your-own-ibeacon-12-638.jpg
Dariusz Seweryn
@dariuszseweryn
iBeacons are mentioned in the wiki
Simone Bianchin
@powext
Hi folks, after i remove a subscription from a notifications monitoring i always get "BleError: Operation was cancelled" and the device remains unavailable.
Bouvier
@fouv
Hi everyone, I need your help regarding disconnection error. To resume, i have a button to connect device and another one to disconnect it. I use the function manager.cancelDeviceConnection(device) and I have this error "Unable to disconnect from device [BleError: Device B5:36:C0:A4:4E:59 is not connected]". But it seems device is well connected if I check in the app BLE scanner. I don't know what is the pb. Need help ... this is my code export const disconnectFromDevice = async(newDevice) => {
device = newDevice.item.id
console.log('device disconnect',device)
manager.cancelDeviceConnection(device)

.then(() => {
setConnectedDeviceStatus(false)
})
.catch(error => {
console.log('Unable to disconnect from device', error);
})
}
bellow my function connectToDevice
//connect to select device
    const connectToDevice =  async(device) => {
    console.log('ok process ongoing to connectToDevice');
    console.log('device nme',device.name);
    console.log('deviceId',device.id)
    setDeviceId(device.id);

    //check connection state of a device
    /*if(manager.isDeviceConnected(deviceId) === true){
            console.log("cancelling");
               manager.cancelDeviceConnection(deviceId); // deconnexion
     }*/

    //setConnectedDeviceList([]);
    //connexion au device
        device.connect()
          .then((connectedDevice) => {
          console.log('device connected',connectedDevice)

     //Add device to connectedDeviceList
      //   setConnectedDeviceList([...connectedDeviceList, device])
     //processing double
          var newConnectedDevice = true
              //console.log('lenght device', deviceList.length)
                       for( let connectDevice of connectedDeviceList ) {
                          if( connectDevice.id === connectedDevice.id ) {
                          //console.log('connect device id',connectDevice.id)
                          //console.log('connected device id',connectedDevice.id)
                          //console.log("ok same devices")
                             newConnectedDevice = false
                             break;
                         } else {
                         console.log('break ?')
                         }
                      }
                      if( newConnectedDevice === true ) {
                      //console.log('device news')
                      setConnectedDeviceList([...connectedDeviceList, device])
                       }

          setConnectedDeviceName(device.name);
          setConnectedDeviceStatus(true);
          setConnectedDevice(device);

        //check deconnection
         //listenerDeviceDisconnect(deviceId);
         //store in AsyncStorage deviceId
         //storeDeviceConnected(device.id)
         //console.log('connectedDevice',connectedDevice)

         console.log('Discovering services and characteristics');
         device.discoverAllServicesAndCharacteristics()
         .then(device=>{ console.log('device discover',device.name)})
         .catch(c=>{console.log('error discover',c)})
         })
         .then((device) => {
         console.log('Setting notifications');
         //const services = device.services();
         })
         .catch(error => {
         if(error) {
         console.log('error connectToDevice',error)
         }
          })
        }
Stéphane Juban
@StephaneJuban

Hi !

Recently I have some iOS phone that failed to keep the connection active. I can connect to my device, but after some delay (it looks like every time, 30s after connecting), it gets automatically disconnected.
When I check with onDeviceDisconnected I have no error.

Any idea why ?

Prateek Sharma
@Sharma1220_twitter
Hi guys, I am using React-Native-Ble-Plx lib. I am always getting this error [BleError: Operation was cancelled] on manager.connectToDevice(device id) in iOS. it is working fine for Android. But somehow it is not working on iOS now. It was working on both platforms earlier.
Is anybody have an idea to solve this issue?
Datagrdn
@Datagrdn
Hello everyone, finally got my hands on a Samsung Galaxy to troubleshoot. All our customers with various models of this phone say they are unable to connect to our device. I'm not seeing any errors in the logs but it is not discovering my device. Does anyone know of why a Galaxy might be different from other Android devices? Thanks so much!
Datagrdn
@Datagrdn
Interesting, getting inconsistent results. Now I can discover devices but when I connect it immediately disconnections with 2021-02-18 22:45:41.863 18865-20061/com.datagarden.plantwaveandroid W/ReactNativeJS: Possible Unhandled Promise Rejection (id: 0): BleError: Characteristic 6e400002-b5a3-f393-e0a9-e50e24dcca9e write failed for device FC:F5:C4:08:98:6A and service 6e400001-b5a3-f393-e0a9-e50e24dcca9
unless I manually send a message to the peripheral via the app. Again this is the exact setup that works on Pixel and other Android devices
It seems like RxBLE doesn't get consistent access to the native Bluetooth functions
Datagrdn
@Datagrdn
Ah got this right before the above error now
2021-02-18 23:17:19.443 28788-30924/com.datagarden.plantwaveandroid W/RxBle#ConnectionOperationQueue: Queue's awaitRelease() has been interrupted abruptly while it wasn't released by the release() method.
    java.lang.InterruptedException
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Object.java:442)
        at java.lang.Object.wait(Object.java:568)
        at com.polidea.rxandroidble.internal.serialization.QueueSemaphore.awaitRelease(QueueSemaphore.java:15)
        at com.polidea.rxandroidble.internal.serialization.ConnectionOperationQueueImpl$1.run(ConnectionOperationQueueImpl.java:73)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
2021-02-18 23:17:19.597 28788-28788/com.datagarden.plantwaveandroid E/ViewRootImpl: sendUserActionEvent() mView returned.
Stéphane Juban
@StephaneJuban
Is this library still supported ? I am wondering since Polidea was acquired by snowflake
1 reply
Lucas Ramage
@lramage94_gitlab
2021-02-17 10:13:14.105 -0500 EST error RN Method.java:-2 java.lang.reflect.Method.invoke 20681_46fa990f-2e9b-5bc0-9823-5cbbdb28e927 4.15.15 1024605174 en 10 245213 106  Error while reading characteristic (service: 0000181c-0000-1000-8000-00805f9b34fb, characteristic: 00002B00-0000-1000-8000-00805f9b34fb): Error BleError: Characteristic 00002b00-0000-1000-8000-00805f9b34fb read failed for device 08:7C:BE:7F:1A:1F and service 0000181c-0000-1000-8000-00805f9b34fb
2021-02-17 10:13:14.111 -0500 EST error RN Method.java:-2 java.lang.reflect.Method.invoke 20681_46fa990f-2e9b-5bc0-9823-5cbbdb28e927 4.15.15 1024605174 en 10 245213 107  BleError: Characteristic 00002b00-0000-1000-8000-00805f9b34fb read failed for device 08:7C:BE:7F:1A:1F and service 0000181c-0000-1000-8000-00805f9b34fb
2021-02-17 10:13:14.118 -0500 EST error RN Method.java:-2 java.lang.reflect.Method.invoke 20681_46fa990f-2e9b-5bc0-9823-5cbbdb28e927 4.15.15 1024605174 en 10 245213 108  Error while reading characteristic (service: 0000181c-0000-1000-8000-00805f9b34fb, characteristic: 00002B03-0000-1000-8000-00805f9b34fb): Error BleError: Device 08:7C:BE:7F:1A:1F is not connected
2021-02-17 10:13:14.119 -0500 EST warning RN Method.java:-2 java.lang.reflect.Method.invoke 20681_46fa990f-2e9b-5bc0-9823-5cbbdb28e927 4.15.15 1024605174 en 10 245213 109  connection error: Device 08:7C:BE:7F:1A:1F is not connected, retry: 2
2021-02-17 10:13:14.131 -0500 EST warning RN Method.java:-2 java.lang.reflect.Method.invoke 20681_46fa990f-2e9b-5bc0-9823-5cbbdb28e927 4.15.15 1024605174 en 10 245213 110  BleError: Device 08:7C:BE:7F:1A:1F is not connected
2021-02-17 10:13:16.405 -0500 EST error RN Method.java:-2 java.lang.reflect.Method.invoke 20681_46fa990f-2e9b-5bc0-9823-5cbbdb28e927 4.15.15 1024605174 en 10 245213 122  Error while reading characteristic (service: 0000181c-0000-1000-8000-00805f9b34fb, characteristic: 00002B00-0000-1000-8000-00805f9b34fb): Error BleError: Device 08:7C:BE:7F:1A:1F was disconnected
2021-02-17 10:13:19.725 -0500 EST error RN Method.java:-2 java.lang.reflect.Method.invoke 20681_46fa990f-2e9b-5bc0-9823-5cbbdb28e927 4.15.15 1024605174 en 10 245213 133  Error while reading characteristic (service: 0000181c-0000-1000-8000-00805f9b34fb, characteristic: 00002B00-0000-1000-8000-00805f9b34fb): Error BleError: Characteristic 00002b00-0000-1000-8000-00805f9b34fb read failed for device 08:7C:BE:7F:1A:1F and service 0000181c-0000-1000-8000-00805f9b34fb
2021-02-17 10:13:19.726 -0500 EST error RN Method.java:-2 java.lang.reflect.Method.invoke 20681_46fa990f-2e9b-5bc0-9823-5cbbdb28e927 4.15.15 1024605174 en 10 245213 134  BleError: Characteristic 00002b00-0000-1000-8000-00805f9b34fb read failed for device 08:7C:BE:7F:1A:1F and service 0000181c-0000-1000-8000-00805f9b34fb
2021-02-17 10:13:19.733 -0500 EST error RN Method.java:-2 java.lang.reflect.Method.invoke 20681_46fa990f-2e9b-5bc0-9823-5cbbdb28e927 4.15.15 1024605174 en 10 245213 135  Error while reading characteristic (service: 0000181c-0000-1000-8000-00805f9b34fb, characteristic: 00002B03-0000-1000-8000-00805f9b34fb): Error BleError: Device 08:7C:BE:7F:1A:1F is not connected
2021-02-17 10:13:19.734 -0500 EST warning RN Method.java:-2 java.lang.reflect.Method.invoke 20681_46fa990f-2e9b-5bc0-9823-5cbbdb28e927 4.15.15 1024605174 en 10 245213 136  connection error: Device 08:7C:BE:7F:1A:1F is not connected, retry: 2
2021-02-17 10:13:19.746 -0500 EST warning RN Method.java:-2 java.lang.reflect.Method.invoke 20681_46fa990f-2e9b-5bc0-9823-5cbbdb28e927 4.15.15 1024605174 en 10 245213 137  BleError: Device 08:7C:BE:7F:1A:1F is not connected
2021-02-17 10:13:25.184 -0500 EST error RN Method.java:-2 java.lang.reflect.Method.invoke 20681_46fa990f-2e9b-5bc0-9823-5cbbdb28e927 4.15.15 1024605174 en 10 245213 159  Error while reading characteristic (service: 0000181c-0000-1000-8000-00805f9b34fb, characteristic: 00002B00-0000-1000-8000-00805f9b34fb): Error BleError: Characteristic 00002b00-0000-1000-8000-00805f9b34fb read failed for device 08:7C:BE:7F:1A:1F and service 0000181c-0000-1000-8000-00805f9b34fb
2021-02-17 10:13
4 replies
Tuanpm31
@Tuanpm31
anyone have an example of multiple connections? Thanks for helping
6 replies
spkteam
@spkteam
Hi everyone, I was trying to read the manufacturerData from my BLE device and it comes encoded. I looked up the documentation and see that the value is base64 encoded.
But when I decode it back, I get an entirely different string.
https://polidea.github.io/react-native-ble-plx/#devicemanufacturerdata
10 replies
Is there a specific method to parse it?
Bouvier
@fouv
Hi,
Bouvier
@fouv
I need to recover an acknowledgment in my function writeCharacteristicWithResponseForDevice..I use a promise in my function but as it is resolved, i see that my code continues to execute instead of waiting for the acknowledgment. How can I do to resolve this pb ?
2 replies
Semih Aydıntepe
@semihaydintepe
Hi everyone. We are developing a Bluetooth thermometer application. react-native-ble-plx library scannes every 10 seconds and connects to the thermometer with a 128 bit service uuid. As long as the thermometer is not disconnected, IOS continues to receive data in the background. If the thermometer connection is disconnected while the ios application is in the background, the thermometer can be connected again within 4 minutes. After 4 minutes, there is no connection again. Can you help with this situation?
4 replies
Maxcravo
@Maxcravo
I new user of this library, i need to configurate the IOS and android for the library proprerly work, even if i only want to test in android ? sorry if its a silly question.
1 reply
Spixz
@Spixz7_twitter
Hello everyone. I'm trying to enable notifications for one of my characteristic. I tried to write the CCCD but I could see from much older posts that the library handled the activation of notifications/indications for us through the "monitorCharacteristicForService" method. After trying it out, my CCCD value was set to 2 ([1, 0]). I would like to enable notifications rather than indications. If indication was chosen automatically, does that mean that the notifications "mode" is not available for this characteristic ? If not, how can I switch from indication to notification without writing to the CCCD (this method does not work). Thank you and have a nice day :)
1 reply
Bouvier
@fouv
Hi, I have an issue when I want to update the firmware from my phone to a card by BLE .I use function writeCharacteristicWithResponseForDevice() to send part of the binary file . At the beginning, response is ok but after 10 or 15mn, i have the error BleError : operation was cancelled. and then device is disconnected ! i don't understand what happening ?
1 reply
balazsdev
@mblasee

Hi All,
I am writing an application where I am firing notifications on a characteristic at every 25ms. I am successfully reading them in my app for a while when suddenly I am getting the following error:

Warning: Please report: Excessive number of pending callbacks: 501. Some pending callbacks that might have leaked by never being called from native code: {"3067":{"module":"BleClientManager","method":"monitorCharacteristicForDevice"},"20750":{"module":"BleClientManager","method":"readCharacteristic"},"20767":{},"20793":{"module":"BleClientManager","method":"readCharacteristic"},"20799":{"module":"BleClientManager","method":"readCharacteristic"},"20826":{"module":"BleClientManager","method":"readCharacteristic"},"20848":{"module":"BleClientManager","method":"readCharacteristic"},"20859":{},"20875":{"module":"BleClientManager","method":"readCharacteristic"},"....... and this goes on.

I guess I am firing up events faster than react is capable of handling them.

Do you guys see any errors in my code? Or is it fine and my options are to switch to native or decrease the notification frequency?

device.monitorCharacteristicForService(service, characteristic, (error, characteristic) => {
    if (error) {
        console.log(`registerNotifyReadCallback; error ${error}`);
        return;
    }
    const value = characteristic?.read().then(data => {
        console.log("value")
        const decodedResponse = base64.decode(data.value);
        console.log(decodedResponse)
        callback(decodedResponse);
    });
});

callback in this case is just simply a set method of a hook state
(const [remoteVal, setRemoteVal] = useState<string>("");)

5 replies
Ezran Bayantemur
@ezranbayantemur
Hi there everyone. I wanna contribute the documentation about background job on Android. But I couldn't find to send PR to wiki page. Anyone know how to do it?
2 replies
Jorge Rodriguez
@rodri0315
I'm trying to follow the documentation to setup a simulated device but I keep getting this error message.
Unhandled promise rejection TypeError: blemulatorModule.simulate is not a function
timmywilmot24
@timmywilmot24
Hello everyone. Is anyone having the issue when trying to import the BleManager() and getting the error: Invariant Violation: new NativeEventEmitter requires non-null argument