react-native-ble-manager
react-native-ble-manager copied to clipboard
readRSSI on Android 7 does nothing
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
- Launch connect function.
- 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
Check the phone permission.