Android volley DefaultRetryPolicy do not work as intended
Do you need to use the DefaultRetryPolicy?
Because you could define your own.
Instead of this:
RetryPolicy policy = new DefaultRetryPolicy(socketTimeout,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
Try this:
jsObjRequest.setRetryPolicy(new RetryPolicy() {
@Override
public int getCurrentTimeout() {
// Here goes the new timeout
return mySeconds;
}
@Override
public int getCurrentRetryCount() {
// The max number of attempts
return myAttempts;
}
@Override
public void retry(VolleyError error) throws VolleyError {
// Here you could check if the retry count has gotten
// To the max number, and if so, send a VolleyError msg
// or something
}
});