I am writing an Android App and I am trying to Login to the system , but the Loading Dialog Tack a lot time to disappear Although the system has completed the Login process . How to set session timeout fro the Login process ??
Thank.
I am writing an Android App and I am trying to Login to the system , but the Loading Dialog Tack a lot time to disappear Although the system has completed the Login process . How to set session timeout fro the Login process ??
Thank.
Try this .
Set timeout in your code .
HttpURLConnection
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
// edit here ,change time
connection.setConnectTimeout(20000);
connection.setReadTimeout(20000);
OKHttp
private final OkHttpClient client;
public ConfigureTimeouts() throws Exception {
client = new OkHttpClient.Builder()
.connectTimeout(100, TimeUnit.SECONDS)
.writeTimeout(100, TimeUnit.SECONDS)
.readTimeout(100, TimeUnit.SECONDS)
.build();
}
Create a andler and dismiss the dialog inside post delayed method.
new Handler().postDelayed(new Runnable() {
public void run() {
dialog_obj.dismiss();
}
}, 6000);
this code will dismiss the dialog after 6 seconds.