We are working on Android BLE & implemented successfully and it’s working fine with all OS version and devices.
We are able to connect successfully using below code:
mBluetoothDevice.connectGatt(this, true, mGattCallback);
connectGatt
But recently Samsung released Android Oreo(8.0.0) for Samsung Galaxy S9, S9+,S8, S8+ etc devices. Now we are not able to connect with BLE in Samsung devices with Android Oreo using above method. We didn’t get any callback in mGattCallback
.
When the autoconnect
flag true
, the log is:
06-16 14:03:39.666 13724-13724/com.ble D/BluetoothGatt: cancelOpen() - device: DA:32:19:58:63:69
06-16 14:03:39.667 13724-13724/com.ble D/BluetoothGatt: close()
06-16 14:03:39.668 13724-13724/com.ble D/BluetoothGatt: unregisterApp() - mClientIf=0
06-16 14:03:39.792 13724-13724/com.ble D/BluetoothGatt: connect() - device: DA:32:19:58:63:69, auto: true
06-16 14:03:39.793 13724-13724/com.ble D/BluetoothGatt: registerApp()
06-16 14:03:39.793 13724-13724/com.ble D/BluetoothGatt: registerApp() - UUID=f672f50e-d321-4785-9af7-0668e5222970
06-16 14:03:39.797 13724-15182/com.ble D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
But if change the autoconnect
flag to false
then it’s working.
06-16 14:05:29.486 15681-15681/com.ble D/BluetoothGatt: connect() - device: DA:32:19:58:63:69, auto: false
06-16 14:05:29.487 15681-15681/com.ble D/BluetoothGatt: registerApp()
06-16 14:05:29.487 15681-15681/com.ble D/BluetoothGatt: registerApp() - UUID=a7c4d089-4ba2-422e-b2d1-355d56f6cc8b
06-16 14:05:29.489 15681-16134/com.ble D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
06-16 14:05:30.198 15681-16134/com.ble D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=5 device=DA:32:19:58:63:69
06-16 14:05:30.202 15681-16134/com.ble D/BluetoothGatt: discoverServices() - device: DA:32:19:58:63:69
06-16 14:05:30.503 15681-16134/com.ble D/BluetoothGatt: onConnectionUpdated() - Device=DA:32:19:58:63:69 interval=6 latency=0 timeout=500 status=0
06-16 14:05:31.033 15681-16134/com.ble D/BluetoothGatt: onSearchComplete() = Device=DA:32:19:58:63:69 Status=0
06-16 14:05:31.055 15681-16134/com.ble D/BluetoothGatt: setCharacteristicNotification() - uuid: 00001734-2927-efef-cdab-eba0fe583711 enable: true
06-16 14:05:31.108 15681-16134/com.ble D/BluetoothGatt: onConnectionUpdated() - Device=DA:32:19:58:63:69 interval=39 latency=0 timeout=500 status=0
When we apply this change it does not connect when the user goes out of range and come again in the range in all devices.
If anyone knows the solutions, please post here.