Closed rauliordache closed 3 years ago
And what does this have to do with the Blessed library? You don't seem to be using it.....
I am using it ...
/**
* Start the module. It starts the parsing thread and also scans & connects to a BerryMed device
*/
private void start(){
// Create BluetoothCentral
central = new BluetoothCentral(context, bluetoothCentralCallback, new Handler());
// Scan for peripherals with a certain service SSID or MAC
central.startPairingPopupHack();
central.scanForPeripheralsWithNames(new String[]{"BerryMed"});
//central.scanForPeripheralsWithAddresses(new String[]{"34:81:F4:4B:E7:48"});
}
That's odd, I don't see any logs that Blessed would normally create. Did you include Timber as a dependency in your project?
The second log you post looks normal but in the first one, discoverServices() isn't even called. It seems the connection breaks directly after being connected...
I have just included Timber. And also, I have found the issue!
By default, in BLESSED the connection timeout is set to 35s
// Timeout to use if no callback on onConnectionStateChange happens
private static final int CONNECTION_TIMEOUT_IN_MS = 35000; // 35s
Thus, I have the following behavior
01-06 05:26:15.236 30778-30778/? D/BluetoothGatt: connect() - device: 34:81:F4:4B:E7:48, auto: false
01-06 05:26:15.236 30778-30778/? D/BluetoothGatt: registerApp()
01-06 05:26:15.237 30778-30778/? D/BluetoothGatt: registerApp() - UUID=c314b80e-7ed4-42eb-b76e-31374841fcca
01-06 05:26:15.246 30778-30800/? D/BluetoothGatt: onClientRegistered() - status=0 clientIf=1
01-06 05:26:15.246 30778-30800/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-06 05:26:16.242 29556-29908/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-06 05:26:16.242 29556-29908/? D/BluetoothRemoteDevices: aclStateChangeCallback: State:Connected to Device:34:81:F4:4B:E7:48
01-06 05:26:16.244 749-1426/? V/ActivityManager: Broadcast: Intent { act=android.bluetooth.device.action.ACL_CONNECTED flg=0x4000010 (has extras) } ordered=false userid=0 callerApp=ProcessRecord{ff4fa4f 29556:com.android.bluetooth/1002}
01-06 05:26:16.247 1259-1259/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
[...]
01-06 05:26:50.280 29556-29920/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-06 05:26:50.282 30778-30778/? D/BluetoothDevice: getName: name = BerryMed
[...]
// After exactly 35s from connect(),
// It is called the timeoutRunnable from [startConnectionTime](https://github.com/weliem/blessed-android/blob/master/blessed/src/main/java/com/welie/blessed/BluetoothPeripheral.java#L1873)(BluetoothPeripheral)
**01-06 05:26:50.283 30778-30778/? E/BluetoothPeripheral: connection timout, disconnecting 'BerryMed'**
01-06 05:26:50.284 30778-30778/? D/BluetoothGatt: close()
01-06 05:26:50.284 30778-30778/? D/BluetoothGatt: unregisterApp() - mClientIf=1
01-06 05:26:50.307 30778-30778/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
[...]
01-06 05:26:55.336 30778-30778/? I/BluetoothPeripheral: autoConnect to 'BerryMed' (34:81:F4:4B:E7:48) using TRANSPORT_LE
01-06 05:26:55.341 30778-30778/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-06 05:26:55.342 30778-30778/? D/BluetoothGatt: connect() - device: 34:81:F4:4B:E7:48, auto: true
01-06 05:26:55.343 30778-30778/? D/BluetoothGatt: registerApp()
01-06 05:26:55.345 30778-30778/? D/BluetoothGatt: registerApp() - UUID=1686954c-a126-4e5e-995f-c33c2074e318
01-06 05:26:55.349 30778-30800/? D/BluetoothGatt: onClientRegistered() - status=0 clientIf=1
01-06 05:26:55.349 30778-30800/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
// And it remains stuck here.
After changing:
// Timeout to use if no callback on onConnectionStateChange happens
private static final int CONNECTION_TIMEOUT_IN_MS = 60000; // 1 min
Everything is ok, BUT the first attempt is always failing (and it is annoying to wait exactly 50 seconds - see below:)
01-07 02:29:11.393 3764-3764/com.myapp D/BluetoothDevice: getName: name = BerryMed
01-07 02:29:11.398 2951-2970/? D/BluetoothAdapterService(912295957): getState() - mAdapterProperties: com.android.bluetooth.btservice.AdapterProperties@35712ef
01-07 02:29:11.398 3764-3764/com.myapp D/BluetoothAdapter: 898304263: getState(). Returning 12
01-07 02:29:11.402 2751-2751/? D/BluetoothDevice: getAlias: alias = null
01-07 02:29:11.403 3764-3764/com.myapp I/BluetoothLeScanner: startRegisteration: mLeScanClients={com.welie.blessed.BluetoothCentral$1@2b5d2a34=android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper@16452ea3} ,callback=com.welie.blessed.BluetoothCentral$1@2b5d2a34
01-07 02:29:11.410 3764-3764/com.myapp I/BluetoothCentral: scan stopped
01-07 02:29:11.410 3764-3764/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:11.410 3764-3764/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:11.413 2951-3007/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:11.413 2951-2970/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:11.414 3764-3764/com.myapp D/BluetoothDevice: getType: type = 3
01-07 02:29:11.414 3764-3764/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:11.421 2751-2751/? D/BluetoothDevice: getName: name = BerryMed
01-07 02:29:11.421 2751-2751/? D/BluetoothDevice: getAliasName: name = BerryMed
01-07 02:29:11.421 2751-2751/? D/CachedBluetoothDevice: fetchName, AlaisName is BerryMed
01-07 02:29:11.421 2751-2751/? D/CachedBluetoothDevice: fetchName, Return Name BerryMed
01-07 02:29:11.421 2751-2751/? V/BluetoothEventManager: Received android.bluetooth.device.action.CLASS_CHANGED
01-07 02:29:11.422 2751-2751/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:11.423 2951-2971/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:11.424 2751-2751/? D/BluetoothDevice: getBluetoothClass: classInt = 0
01-07 02:29:11.424 2751-2751/? D/CachedBluetoothDevice: fetchClass, mBtClass is 0
01-07 02:29:11.424 2751-2751/? V/BluetoothEventManager: Received android.bluetooth.device.action.FOUND
01-07 02:29:11.424 2751-2751/? D/BluetoothEventManager: Device BerryMed ,Class: 0
01-07 02:29:11.424 2751-2751/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:11.520 2951-2975/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:11.521 3764-3764/com.myapp D/BluetoothDevice: getName: name = BerryMed
01-07 02:29:11.521 3764-3764/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:11.523 3764-3764/com.myapp I/BluetoothPeripheral: connect to 'BerryMed' (34:81:F4:4B:E7:48) using TRANSPORT_LE
01-07 02:29:11.533 3764-3764/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
// connect() at 02:29:11
01-07 02:29:11.535 3764-3764/com.myapp D/BluetoothGatt: connect() - device: 34:81:F4:4B:E7:48, auto: false
01-07 02:29:11.537 3764-3764/com.myapp D/BluetoothGatt: registerApp()
01-07 02:29:11.537 3764-3764/com.myapp D/BluetoothGatt: registerApp() - UUID=a4be3f2f-9d1d-4f37-8241-af5875908b50
01-07 02:29:11.539 3764-3786/com.myapp D/BluetoothGatt: onClientRegistered() - status=0 clientIf=1
01-07 02:29:11.540 3764-3786/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:11.974 748-1490/? V/ActivityManager: Broadcast: Intent { act=android.bluetooth.device.action.ACL_CONNECTED flg=0x4000010 (has extras) } ordered=false userid=0 callerApp=ProcessRecord{1258d6c4 2951:com.android.bluetooth/1002}
01-07 02:29:11.973 2951-2973/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:11.973 2951-2973/? D/BluetoothRemoteDevices: aclStateChangeCallback: State:Connected to Device:34:81:F4:4B:E7:48
01-07 02:29:11.975 1352-1352/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:11.977 1352-1852/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:12.012 2951-2971/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:12.013 1352-1852/? D/BluetoothDevice: getBluetoothClass: classInt = 0
01-07 02:29:12.014 2951-2975/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:12.014 1352-1852/? D/BluetoothDevice: getBluetoothClass: classInt = 0
01-07 02:29:12.017 2951-3007/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:12.017 1352-1852/? D/BluetoothDevice: getName: name = BerryMed
01-07 02:29:12.022 2951-2970/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:12.022 2951-2970/? D/BluetoothRemoteDevices: getAlias: mAlias = null
01-07 02:29:12.022 1352-1852/? D/BluetoothDevice: getAlias: alias = null
01-07 02:29:19.026 748-1349/? V/ActivityManager: Broadcast: Intent { act=android.bluetooth.device.action.NAME_CHANGED flg=0x4000010 (has extras) } ordered=false userid=0 callerApp=ProcessRecord{1258d6c4 2951:com.android.bluetooth/1002}
01-07 02:29:19.014 2951-2973/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:19.014 2951-2973/? I/BluetoothBondStateMachine: bondStateChangeCallback: Status: 0 Address: 34:81:F4:4B:E7:48 newState: 2
01-07 02:29:19.015 2951-2974/? E/BluetoothBondStateMachine: In stable state, received invalid newState: 12
01-07 02:29:19.019 2951-2973/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:19.020 2951-2973/? D/BluetoothRemoteDevices: devicePropertyChangedCallback: bdDevice = 34:81:F4:4B:E7:48
01-07 02:29:19.020 2951-2973/? D/BluetoothRemoteDevices: devicePropertyChangedCallback: Acquire Lock - RemoteDevices.mObject
01-07 02:29:19.020 2951-2973/? D/BluetoothRemoteDevices: Send Broadcast: Device Name
01-07 02:29:19.028 2951-2973/? D/BluetoothRemoteDevices: Remote Device name is: BerryMed
01-07 02:29:19.028 2951-2973/? D/BluetoothRemoteDevices: devicePropertyChangedCallback: Release Lock - RemoteDevices.mObject
01-07 02:29:19.040 2751-2751/? V/BluetoothEventManager: Received android.bluetooth.device.action.NAME_CHANGED
01-07 02:29:19.040 2751-2751/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:19.041 2951-2971/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:19.041 2951-2971/? D/BluetoothRemoteDevices: getAlias: mAlias = null
01-07 02:29:19.042 2751-2751/? D/BluetoothDevice: getAlias: alias = null
01-07 02:29:19.043 2951-2975/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:19.044 2751-2751/? D/BluetoothDevice: getName: name = BerryMed
01-07 02:29:19.044 2751-2751/? D/BluetoothDevice: getAliasName: name = BerryMed
01-07 02:29:19.044 2751-2751/? D/CachedBluetoothDevice: fetchName, AlaisName is BerryMed
01-07 02:29:19.044 2751-2751/? D/CachedBluetoothDevice: fetchName, Return Name BerryMed
01-07 02:29:53.104 748-1050/? V/ActivityManager: Broadcast: Intent { act=android.bluetooth.device.action.ACL_DISCONNECTED flg=0x4000010 (has extras) } ordered=false userid=0 callerApp=ProcessRecord{1258d6c4 2951:com.android.bluetooth/1002}
01-07 02:29:53.102 2951-2973/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:53.102 2951-2973/? D/BluetoothRemoteDevices: aclStateChangeCallback: State:DisConnected to Device:34:81:F4:4B:E7:48
01-07 02:29:53.110 1352-1352/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:53.110 2951-2951/? D/[MAP]BluetoothMapService: [MapBroadcastReceiver] onReceive
01-07 02:29:53.114 1352-1852/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:53.122 3764-3787/com.myapp D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=1 device=34:81:F4:4B:E7:48
01-07 02:29:53.122 3764-3787/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
// After 42s ( > 35s) from connect() we get "cancelling connect attempt":
01-07 02:29:53.123 3764-3787/com.myapp I/BluetoothPeripheral: cancelling connect attempt
01-07 02:29:53.123 3764-3787/com.myapp D/BluetoothGatt: close()
01-07 02:29:53.123 3764-3787/com.myapp D/BluetoothGatt: unregisterApp() - mClientIf=1
01-07 02:29:53.127 3764-3787/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:53.127 3764-3787/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:58.133 3764-3764/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:58.134 3764-3764/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:58.137 2951-2975/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:58.138 3764-3764/com.myapp D/BluetoothDevice: getType: type = 3
01-07 02:29:58.138 3764-3764/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:58.142 2951-3007/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:58.143 3764-3764/com.myapp D/BluetoothDevice: getName: name = BerryMed
01-07 02:29:58.143 3764-3764/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:58.144 3764-3764/com.myapp I/BluetoothPeripheral: autoConnect to 'BerryMed' (34:81:F4:4B:E7:48) using TRANSPORT_LE
01-07 02:29:58.147 3764-3764/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
// The second attempt works.
01-07 02:29:58.148 3764-3764/com.myapp D/BluetoothGatt: connect() - device: 34:81:F4:4B:E7:48, auto: true
01-07 02:29:58.148 3764-3764/com.myapp D/BluetoothGatt: registerApp()
01-07 02:29:58.148 3764-3764/com.myapp D/BluetoothGatt: registerApp() - UUID=d6f892c0-efa1-486f-a88c-056dbe5a95a0
01-07 02:29:58.150 3764-3787/com.myapp D/BluetoothGatt: onClientRegistered() - status=0 clientIf=1
01-07 02:29:58.150 3764-3787/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:59.460 2951-2973/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:59.460 2951-2973/? D/BluetoothRemoteDevices: aclStateChangeCallback: State:Connected to Device:34:81:F4:4B:E7:48
01-07 02:29:59.466 748-1349/? V/ActivityManager: Broadcast: Intent { act=android.bluetooth.device.action.ACL_CONNECTED flg=0x4000010 (has extras) } ordered=false userid=0 callerApp=ProcessRecord{1258d6c4 2951:com.android.bluetooth/1002}
01-07 02:29:59.470 1352-1352/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:59.480 3764-3786/com.myapp D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=1 device=34:81:F4:4B:E7:48
01-07 02:29:59.480 3764-3786/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:59.481 2951-2975/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:59.481 3764-3786/com.myapp D/BluetoothDevice: getBondState: state = 10
01-07 02:29:59.484 2951-3007/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:59.484 3764-3786/com.myapp D/BluetoothDevice: getName: name = BerryMed
01-07 02:29:59.487 3764-3786/com.myapp I/BluetoothPeripheral: connected to 'BerryMed' (BOND_NONE) in 1.3s
01-07 02:29:59.489 2951-2970/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:59.489 3764-3764/com.myapp D/BluetoothDevice: getName: name = BerryMed
01-07 02:29:59.489 3764-3764/com.myapp D/BluetoothPeripheral: discovering services of 'BerryMed' with delay of 0 ms
01-07 02:29:59.490 3764-3764/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:59.490 3764-3764/com.myapp D/BluetoothGatt: discoverServices() - device: 34:81:F4:4B:E7:48
01-07 02:29:59.490 3764-3764/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:59.491 1352-1852/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:59.509 2951-2975/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:59.510 1352-1852/? D/BluetoothDevice: getBluetoothClass: classInt = 0
01-07 02:29:59.511 2951-3007/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:59.512 1352-1852/? D/BluetoothDevice: getBluetoothClass: classInt = 0
01-07 02:29:59.513 2951-2970/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:59.514 1352-1852/? D/BluetoothDevice: getName: name = BerryMed
01-07 02:29:59.516 2951-2971/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:59.516 2951-2971/? D/BluetoothRemoteDevices: getAlias: mAlias = null
01-07 02:29:59.516 1352-1852/? D/BluetoothDevice: getAlias: alias = null
01-07 02:30:01.372 3764-3787/com.myapp D/BluetoothGatt: onGetService() - Device=34:81:F4:4B:E7:48 UUID=00001800-0000-1000-8000-00805f9b34fb
01-07 02:30:01.372 3764-3787/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:30:01.378 3764-3786/com.myapp D/BluetoothGatt: onGetService() - Device=34:81:F4:4B:E7:48 UUID=0000180a-0000-1000-8000-00805f9b34fb
01-07 02:30:01.378 3764-3786/com.myapp D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
// Now everything is okay, after 50s from the first attempt ...
Later edit:
I have tried a trick - setting the timeout to 100 ms
private static final int CONNECTION_TIMEOUT_IN_MS = 100;
But it also temporize the connection with 10 seconds (the entire cycle: connect() - forced timeout - autoConnect() cannot be done in less than 10 s)
Hi, ok now we can see better what is happening.
The basically problem I see is that in the first case, the device seems to connect fairly quickly but the bluetooth stack never calls onClientConnectionState(). So you see:
01-06 05:26:16.242 29556-29908/? D/BluetoothRemoteDevices: aclStateChangeCallback: State:Connected to Device:34:81:F4:4B:E7:48
But there is no call to onClientConnectionState(). So Blessed doesn't get to know the device actually connected. Hence after 35 seconds the timeout goes off and a disconnect is issued.
In the second case the onClientConnectionState is called normally:
01-07 02:29:59.460 2951-2973/? D/BluetoothRemoteDevices: aclStateChangeCallback: State:Connected to Device:34:81:F4:4B:E7:48
01-07 02:29:59.466 748-1349/? V/ActivityManager: Broadcast: Intent { act=android.bluetooth.device.action.ACL_CONNECTED flg=0x4000010 (has extras) } ordered=false userid=0 callerApp=ProcessRecord{1258d6c4 2951:com.android.bluetooth/1002}
01-07 02:29:59.470 1352-1352/? D/BluetoothDevice: mAddress: 34:81:F4:4B:E7:48
01-07 02:29:59.480 3764-3786/com.myapp D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=1 device=34:81:F4:4B:E7:48
So you can tinker with the timeout delay, but that won't solve the root cause. There is something else that is suspicious and that is this part:
01-07 02:29:19.014 2951-2973/? I/BluetoothBondStateMachine: bondStateChangeCallback: Status: 0 Address: 34:81:F4:4B:E7:48 newState: 2
01-07 02:29:19.015 2951-2974/? E/BluetoothBondStateMachine: In stable state, received invalid newState: 12
...which seems to suggest some 'bonding' is taking place, although things are apparently going wrong. State 12 would normally mean that the device is BOND_BONDED. Can you make sure the device has not been paired via the Bluetooth Settings menu? And if it appears there, remove it...
Anyways, strange things are happening and the bluetooth stack is not working as expected....what device are you using?
Calling from the first time autoConnect() (instead of connect()) in BluetoothCentral - connectPeripheral(...) is ok. It works (with a little delay of 4-5 s)
// Now connect peripheral.autoConnect(); // instead of peripheral.connect();
I will try to find the issue in peripheral.connect();
Any update on this issue?
I am using peripheral.autoConnect() instead of peripheral.connect() (even from the first attempt). I will let you know if I find the issue in .connect().
Hello,
Due to some problems in 7.0, I have downgraded my tablet to the stock version of Android 5.1 (Lollipop) - SDK 22. I cannot connect to my medical device from SDK-22:
On Android 7.0, I can connect to my device for several seconds, then I got a timeout (the famous - status 8). But, at least, an initial connection is estabilished. I have downgraded to 5.1 because Nougat has several problems regarding BLE connection timeout (hard-coded t - 20 seconds). On Nougat
Can you help me, please, at least with the 5.1(SDK22) version? Thanks.
Later Edit: As I can see, the BluetoothGatt.discoverServices() callback is never reached on Lollipop.