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

readRSSI on Android 7 does nothing

Open Gueoff opened this issue 5 years ago • 1 comments

Version

Tell us which versions you are using:

  • react-native-ble-manager v7.3.1
  • react-native v0.61.4
  • Android v.7.0

Expected behaviour

The method reads the peripheral RSSI and returns value between -1 & -80

Actual behaviour

The method does nothing and never stops

Steps to reproduce

  1. Launch connect function.
  2. Launch readRSSI function

Stack trace and console log

Call in my app:

console.log('before');
await BleManager.connect(identifier);
console.log('between');
await BleManager.readRSSI(identifier);
console.log('after');

Method called in the module:

readRSSI(peripheralId) {
    console.log('readRSSI module method');
    return new Promise((fulfill, reject) => {
      bleManager.readRSSI(peripheralId, (error, rssi) => {
        console.log('result', error, rssi);
        if (error) {
          reject(error);
        } else {
          fulfill(rssi);
        }
      });
    });
  }

I have tested the code bellow on few devices, on my Android 7.0, stack traces are :

before
between
readRSSI module method

on other devices:

before
between
readRSSI module method
result null -54
after

Gueoff avatar Oct 02 '20 13:10 Gueoff

Check the phone permission.

marcosinigaglia avatar Oct 06 '20 08:10 marcosinigaglia