From b6c82f494d6e27f8719abacea68d342231407063 Mon Sep 17 00:00:00 2001 From: Shahim Mohammed Date: Wed, 8 Feb 2017 01:00:11 +0530 Subject: [PATCH] fix previous commit breaking bluetooth state change observer --- .../lmbluetoothsdk/service/BluetoothService.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lmbluetoothsdk/src/main/java/co/lujun/lmbluetoothsdk/service/BluetoothService.java b/lmbluetoothsdk/src/main/java/co/lujun/lmbluetoothsdk/service/BluetoothService.java index 7badc93..5804512 100755 --- a/lmbluetoothsdk/src/main/java/co/lujun/lmbluetoothsdk/service/BluetoothService.java +++ b/lmbluetoothsdk/src/main/java/co/lujun/lmbluetoothsdk/service/BluetoothService.java @@ -356,13 +356,11 @@ public void run() { int bytes; while (true) { try { - if (mmInStream.available()>0) { - bytes = mmInStream.read(buffer); - if (bytes>0) { - byte[] data = Arrays.copyOf(buffer,bytes); - if (mBluetoothListener != null) { - ((BluetoothListener) mBluetoothListener).onReadData(mmSocket.getRemoteDevice(), data); - } + bytes = mmInStream.read(buffer); + if (bytes > 0) { + byte[] data = Arrays.copyOf(buffer, bytes); + if (mBluetoothListener != null) { + ((BluetoothListener) mBluetoothListener).onReadData(mmSocket.getRemoteDevice(), data); } } } catch (IOException e) {