From 6af3fc66b570dacaea0e87a84229bd0125855a66 Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Thu, 3 May 2018 23:36:33 +0200 Subject: [PATCH] Sleep a short while before discovering services Let us see if this improves #252. --- .../openscale/core/bluetooth/BluetoothCommunication.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java index b42589b5..e8799f19 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java @@ -530,6 +530,13 @@ public abstract class BluetoothCommunication { connectionEstablished = true; setBtStatus(BT_STATUS_CODE.BT_CONNECTION_ESTABLISHED); + + try { + Thread.sleep(200); + } + catch (Exception e) { + // Empty + } gatt.discoverServices(); } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {