Android VolleyBasicNetwork.logSlowRequests: HTTP response for request

I have a problem with requesting a Volley GET on a slow network. Every time I see BasicNetwork.logSlowRequests in my LogCat, my GET request is executed twice or more, which leads to several (2 or more) postings for 1 request. I have already set up a retry policy, but that does not help.

This is my logcat

03-16 01:31:35.674: D/Volley(5984): [19807] BasicNetwork.logSlowRequests: HTTP response for request=<[ ] http://[myserver]/api/places 0xfa7d0c33 NORMAL 1> [lifetime=3824], [size=313], [rc=200], [retryCount=0] 03-16 01:31:35.704: D/Volley(5984): [1] Request.finish: 3853 ms: [ ] http://[myserver]/api/places 0xfa7d0c33 NORMAL 1 

my code is: -

 StringRequest strReq = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() { @Override public void onResponse(String response) { pd.dismiss(); getColorDetails.getColorresponse(response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { pd.dismiss(); if (error instanceof TimeoutError || error instanceof NoConnectionError) { showSignOutAlertDialog(context, "TimeoutError"); } else if (error instanceof AuthFailureError) { showSignOutAlertDialog(context, "AuthFailureError"); } else if (error instanceof ServerError) { showSignOutAlertDialog(context, "ServerError"); } else if (error instanceof NetworkError) { showSignOutAlertDialog(context, "NetworkError"); } else if (error instanceof ParseError) { showSignOutAlertDialog(context, "ParseError"); } } }) { /** * Passing some request headers * */ @Override public Map<String, String> getHeaders() throws AuthFailureError { HashMap<String, String> headers = new HashMap<String, String>(); //headers.put("Content-Type", "application/json; charset=utf-8"); return headers; } @Override public String getBodyContentType() { return "application/json"; } @Override protected Response<String> parseNetworkResponse(NetworkResponse response) { int mStatusCode = response.statusCode; System.out.println("Status code is===>"+mStatusCode); return super.parseNetworkResponse(response); } }; strReq.setRetryPolicy(new DefaultRetryPolicy(DefaultRetryPolicy.DEFAULT_TIMEOUT_MS * 2, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); AppController.getInstance().addToRequestQueue(strReq); } 
0
android android-volley
Jun 16 '16 at 7:23
source share

No one has answered this question yet.

See similar questions:

57
Android Volley double post when slow request
one
I cannot make a network call using a volley. I tried many solutions but no one worked

or similar:

3606
Close / hide Android soft keyboard
3295
Why is the Android emulator so slow? How can we speed up Android emulator development?
3288
Correct use cases for Android UserManager.isUserAGoat ()?
2609
Is there a unique identifier for an Android device?
2510
How to keep Android activity state by saving instance state?
2097
Is there a way to run Python on Android?
1858
"Debug certificate expired" error in Android Eclipse plugins
1844
What is "Context" on Android?
57
Android Volley double post when slow request
0
E / Volley: [127] BasicNetwork.performRequest: unexpected 401 response code for



All Articles