Skip to content

Commit 6ca4973

Browse files
committed
Fixes issue where gatt is not closed before the next 'connectGatt' is being called resulting resources allocated for gatt is not released until the application is stopped/killed
1 parent bc4aafd commit 6ca4973

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ble/src/main/java/no/nordicsemi/android/ble/BleManagerHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,9 @@ private boolean internalConnect(@NonNull final BluetoothDevice device,
697697
preferredPhy = connectRequest.getPreferredPhy();
698698
}
699699
final int finalPreferredPhy = preferredPhy;
700+
var gatt = bluetoothGatt;
701+
log(Log.DEBUG, () -> "gatt.close()");
702+
gatt.close();
700703
log(Log.DEBUG, () ->
701704
"gatt = device.connectGatt(autoConnect = true, TRANSPORT_LE, "
702705
+ ParserUtils.phyMaskToString(finalPreferredPhy) + ")");

0 commit comments

Comments
 (0)