Volley retry request -
I am currently testing the volley library but when the request fails (404) it did not execute again Or there are at least no errors. However, the data is not lost. This is a request, so it has been unsuccessful, is the right way to try again?
Thanks in advance
req.setRetryPolicy (New DefaultRetryPolicy (5000,1,1f)); Queue.add (request); Usage:
JsonObjectRequest req = null; For (int i = 0; i & lt; profielen.size (); i ++) {final integer = i; Request = New JsonObjectRequest (Request.Method.GET, imageLocUrl, Null, New Response.Listener & lt; JSONObject & gt; () {@Override Public Zero onResponse (JSONObject response) {try {setImageOnProfile (status, response.get (" Thumbnail ") .toString ());} hold (JSONException E) {// TODO auto-built cache block e.printStackTrace ();}}}, New Response.ErrorListener () {@Override Public Zero onErrorResponse (VolleyError Error) {}}); Req.setRetryPolicy (new DefaultRetryPolicy (5000,1,1.0F)); Queue.add (request); }
No, this is not the right way.
Asides:
-
HTTP 404 is not a status code. I would like to try again for the normal state of the usual HTTP client.
-
You are receiving an error through the most liked error listener, but you have been requested that your error listener is such a NOP, which you may Not watching?
-
( http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html is the exact description of the status code meaning.) -
Request retry policy only applies to failures due to: open socket timeout, time to open socket, HTTP 401 and HTTP 403 all other failures automatically re- Are not, AFAIK
(Fix: It would be nice if RetryPolicy was consulted for error status codes. I want to be able to install a policy that tries on 503s).
Comments
Post a Comment