From 9319e8d711653f723a8887c8312604d588818511 Mon Sep 17 00:00:00 2001 From: Aleksander Nowakowski Date: Tue, 6 Nov 2018 16:41:53 +0100 Subject: [PATCH] #25 fixed again: second blood --- .../java/no/nordicsemi/android/ble/BleManager.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ble/src/main/java/no/nordicsemi/android/ble/BleManager.java b/ble/src/main/java/no/nordicsemi/android/ble/BleManager.java index 195f9b95..092fc621 100644 --- a/ble/src/main/java/no/nordicsemi/android/ble/BleManager.java +++ b/ble/src/main/java/no/nordicsemi/android/ble/BleManager.java @@ -257,11 +257,17 @@ public void onReceive(final Context context, final Intent intent) { // The connection is killed by the system, no need to disconnect gently. mUserDisconnected = true; + // Allow new requests when Bluetooth is enabled again. close() doesn't do it. + // See: https://github.com/NordicSemiconductor/Android-BLE-Library/issues/25 + // and: https://github.com/NordicSemiconductor/Android-BLE-Library/issues/41 + mGattCallback.mOperationInProgress = false; + // This will call close() mGattCallback.notifyDeviceDisconnected(mBluetoothDevice); + } else { + // Calling close() will prevent the STATE_OFF event from being logged + // (this receiver will be unregistered). But it doesn't matter. + close(); } - // Calling close() will prevent the STATE_OFF event from being logged - // (this receiver will be unregistered). But it doesn't matter. - close(); break; } }