I was going through BluetoothGatt.java and found the method boolean connect(Boolean autoConnect, BluetoothGattCallback callback, Handler handler)
The documentation just above this method specifies that this is used to initiate a connection with BLE devices.
However, the official Android documentation states that to connect with a BLE device boolean connect() should be used.
The documentation for this connect() method states that this is used to reconnect back to a device.
I am confused here because gatt.connect()
is sometimes unreliable (the callback for the device connected is not called even though the BLE device is in range but connects when I try to connect in the second or third attempt.)
Would it be better to use the method mentioned earlier to increase connection chances during first connection attempt?
Can anyone share some information regarding this?