react-native-bluetooth-serial
react-native-bluetooth-serial copied to clipboard
Calling enable() and subsequently connect() crashes
I'm running on android, and the following code seems to cause the app to crash without any react-native error output. I assume that's because it crashes in native code.
What seems to happen is the app successfully enables bluetooth (i.e. it is enabled when I go check in the device settings), but the app dies when it calls BluetoothSerial.connect(...)
.
var enabled = await BluetoothSerial.isEnabled(); // resolves to false
if (!enabled) {
try {
enabled = await BluetoothSerial.enable();
// enabled is true here
}
catch (error) {
console.log(error);
}
}
try {
await BluetoothSerial.connect(device); // crash without error
}
catch (error) {
console.log(error);
}