From 44cb2df6f9565ec9e7814ee1d8944155b8f55632 Mon Sep 17 00:00:00 2001 From: Steven Moy Date: Thu, 7 May 2015 19:04:13 -0700 Subject: [PATCH] Instead of auto connect, create proxy object & connect in two steps. Tested on HTC One M7 wiht Android 5.0.2. Prior to the change, connect to bluetooth device does not work. --- .../Robotics.Mobile.Core.Droid/Bluetooth/LE/Adapter.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/Platform Stacks/Robotics.Mobile.Core.Droid/Bluetooth/LE/Adapter.cs b/Source/Platform Stacks/Robotics.Mobile.Core.Droid/Bluetooth/LE/Adapter.cs index 62d9010..30fee29 100644 --- a/Source/Platform Stacks/Robotics.Mobile.Core.Droid/Bluetooth/LE/Adapter.cs +++ b/Source/Platform Stacks/Robotics.Mobile.Core.Droid/Bluetooth/LE/Adapter.cs @@ -127,7 +127,11 @@ public void ConnectToDevice (IDevice device) { // returns the BluetoothGatt, which is the API for BLE stuff // TERRIBLE API design on the part of google here. - ((BluetoothDevice)device.NativeDevice).ConnectGatt (Android.App.Application.Context, true, this._gattCallback); + + // Not using autoConnect flag because there are compatibility issue + // found on HTC One (M7) in Android 5.0.2 + var gatt = ((BluetoothDevice)device.NativeDevice).ConnectGatt (Android.App.Application.Context, false, this._gattCallback); + gatt.Connect (); } public void DisconnectDevice (IDevice device)