Skip to content

Commit

Permalink
fix ble android connection issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaskeeeee committed Jun 21, 2024
1 parent 6afdc15 commit 84b4b26
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ public void connect(String id, Double mtu, Promise promise) {
Log.d(NAME, "starting GATT connection");
context.mtu = mtu.intValue();
gattCallback = new BleBluetoothGattCallback(emitter, context, executor);
context.gatt = device.connectGatt(getReactApplicationContext(), false, gattCallback);

// Must specify BluetoothDevice.TRANSPORT_LE otherwise this is not working on certain phones
context.gatt = device.connectGatt(getReactApplicationContext(), false, gattCallback, BluetoothDevice.TRANSPORT_LE);
if (context.gatt == null) {
promise.reject(BleError.ERROR_GATT.name(), "gatt instance is null");
}
Expand Down

0 comments on commit 84b4b26

Please sign in to comment.