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 resulting multiple (2 or more) postings for 1 request. I already set the retry policy to 0, but It doesn't help.
6
1
|
|
http://stackoverflow.com/questions/22428343/android-volley-double-post-when-have-slow-request
//-----------------------------------------自己----------------------------------------
在第三方登陆的时候,总是发现有两次(服务器记录了登陆了两次)。
其实是volley在第一次访问的时候,由于超时时间到了,进行了第二次访问。
gsonRequest.setRetryPolicy(new DefaultRetryPolicy(
DefaultRetryPolicy.DEFAULT_TIMEOUT_MS, 0,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
executeRequest(gsonRequest);
DefaultRetryPolicy.DEFAULT_TIMEOUT_MS, 0,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
executeRequest(gsonRequest);
这样子就可以解决了。