react-native-bluetooth-serial icon indicating copy to clipboard operation
react-native-bluetooth-serial copied to clipboard

Calling enable() and subsequently connect() crashes

Open jlucier opened this issue 8 years ago • 0 comments

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);
}

jlucier avatar Jan 13 '17 17:01 jlucier