diff --git a/library/library.iml b/library/library.iml
index c0cbb2b..68700a4 100644
--- a/library/library.iml
+++ b/library/library.iml
@@ -67,14 +67,6 @@
-
-
-
-
-
-
-
-
@@ -83,7 +75,14 @@
-
+
+
+
+
+
+
+
+
@@ -92,6 +91,7 @@
+
@@ -106,5 +106,6 @@
+
\ No newline at end of file
diff --git a/sample_app/sample_app.iml b/sample_app/sample_app.iml
index b140503..1790c0d 100644
--- a/sample_app/sample_app.iml
+++ b/sample_app/sample_app.iml
@@ -85,7 +85,6 @@
-
@@ -104,10 +103,10 @@
+
-
@@ -138,6 +137,7 @@
+
diff --git a/sample_app/src/main/java/uk/co/alt236/btlescan/services/BluetoothLeService.java b/sample_app/src/main/java/uk/co/alt236/btlescan/services/BluetoothLeService.java
index 2320a13..c0b206f 100644
--- a/sample_app/src/main/java/uk/co/alt236/btlescan/services/BluetoothLeService.java
+++ b/sample_app/src/main/java/uk/co/alt236/btlescan/services/BluetoothLeService.java
@@ -31,6 +31,7 @@ import android.os.Binder;
import android.os.IBinder;
import android.util.Log;
+import java.lang.reflect.Method;
import java.util.List;
/**
@@ -176,7 +177,8 @@ public class BluetoothLeService extends Service {
// parameter to false.
Log.d(TAG, "Trying to create a new connection.");
- mBluetoothGatt = device.connectGatt(this, false, mGattCallback);
+ mBluetoothGatt = device.connectGatt(this, true, mGattCallback);
+ //boolean v = refreshDeviceCache(mBluetoothGatt);
mBluetoothDeviceAddress = address;
setConnectionState(State.CONNECTING, true);
retVal = true;
@@ -186,6 +188,21 @@ public class BluetoothLeService extends Service {
return retVal;
}
+ private boolean refreshDeviceCache(BluetoothGatt gatt){
+ try {
+ BluetoothGatt localBluetoothGatt = gatt;
+ Method localMethod = localBluetoothGatt.getClass().getMethod("refresh", new Class[0]);
+ if (localMethod != null) {
+ boolean bool = ((Boolean) localMethod.invoke(localBluetoothGatt, new Object[0])).booleanValue();
+ return bool;
+ }
+ }
+ catch (Exception localException) {
+ Log.e(TAG, "An exception occured while refreshing device");
+ }
+ return false;
+ }
+
private synchronized void setConnectionState(final State newState, final boolean broadCast) {
Log.i(TAG, "Setting internal state to " + newState);
mConnectionState = newState;