Hello I am new in Android BLE, I am connecting BLE device, in that if connection fails it will try to reconnect 5 times, if still connection failed, then it will show message to user that connection is FAILED other wise it will try 5 times
Below is my code
else if (Utils.ACTION_DEVICE_DISCONNECTED.equals(action)) {
Log.d(TAG, "onReceive: ACTION_DEVICE_DISCONNECTED");
isDeviceConnected = false;
if(!isOnceConnected && tryAgainToConnectCounter < NO_OFF_TIMES_TRY_TO_CONNECT) {
connectdevice();
}else {
tryAgainToConnectCounter = 0;
generateToast(getResources()
.getString(R.string.strdisconnected));
if (progressDialog != null && progressDialog.isShowing()){
progressDialog.dismiss();
}
deviceDisconnectedMsg();
}
}
Now my problem is that when my phone is trying to connect with device & if connection failed, it is taking 18 seconds, in between.
I want to reduce that time, means my phone will try to connect only 5 seconds, and in 5 seconds if it is not possible, it should goes to DEVICE_DISCONNECTED & try to connect again
I have seen below link
Android BLE Connection time interval
but it is for after connection, data pass interval, I want when device is trying to connect
Anybody please help me how to resolve this
Thank you so much