I've created a volley request to receive HTTPS backend.
RequestQueue queue = Volley.newRequestQueue(uiCallback.getContext(),
new SSLVerification().getHurlStack(uiCallback.getContext()));
JsonObjectRequest req = new JsonObjectRequest(Request.Method.GET,
requestUrl, null, new Response.Listener<JSONObject>() {
...
}
req.setRetryPolicy(new DefaultRetryPolicy(3_600_000, 0, 0));
queue.add(req);
In the manifest, I have added the Internet permission as follows:
<uses-permission android:name="android.permission.INTERNET" />
Everything works fine with requests that take only a short while.
But if the response comes over 3 minutes after the request, then the application receives nothing.
On the backend, I've set a breakpoint. After 3 minutes, I've let backend to send a response to the app, but there nothing comes. No success, no error, just nothing.
If I make an HTTP request without SSLVerification
, then I receive a response also after 6 minutes. Instead, HTTPS requests longer than 3 minutes just don't want to work.
Change RetryPolicy
to make many requests it's just a workaround and it's not an option.
The response is taking too long to be received in the device and thus the Volley
is having a TimeoutError
. You need to modify the default timeout value like the following before sending a request to your server.
req.setRetryPolicy(new RetryPolicy() {
@Override
public int getCurrentTimeout() {
return 360000;
}
@Override
public int getCurrentRetryCount() {
return 5000;
}
@Override
public void retry(VolleyError error) throws VolleyError {
}
});
queue.add(req);
Try this
req.setRetryPolicy(new DefaultRetryPolicy(90000, 1, 1f));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With