I have a problem with Volley POST request on slow network. Everytime I see BasicNetwork.logSlowRequests
in my LogCat, my POST request is executed twice or more
I am able to solve this issue by two ways.
First is changed the RetryPolicy
.
Simply set the timeout value to double of the default timeout. Worked fine. You can also try other values.
request.setRetryPolicy(new DefaultRetryPolicy(DefaultRetryPolicy.DEFAULT_TIMEOUT_MS * 2, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
Another way is by setting connection.setChunkedStreamingMode(0);
in openConnection
method HurlStack
class.
I am creating my RequestQueue
like this requestQueue = Volley.newRequestQueue(context, new HurlStack());
Hope it helps :)