Skip to content

Commit 6b5627e

Browse files
authored
Merge pull request #503 from NordicSemiconductor/service-discovery-delay
Adding delay before service discovery on Service Change indication
2 parents fc18853 + 3a6b799 commit 6b5627e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,9 @@ public void onServiceChanged(@NonNull final BluetoothGatt gatt) {
981981
logi("Service Changed indication received");
982982
sendLogBroadcast(LOG_LEVEL_INFO, "Service Changed indication received");
983983
mConnectionState = STATE_CONNECTED;
984-
discoverServices(gatt);
984+
// Apparently, adding a delay here solves a connectivity issue for micro:bit v1.
985+
// See: https://github.com/NordicSemiconductor/Android-DFU-Library/issues/500
986+
mHandler.postDelayed(() -> discoverServices(gatt), 1000); // minimum 550 ms
985987
}
986988

987989
/**

0 commit comments

Comments
 (0)