Android Volley double post when have slow request

后端 未结 18 2694
生来不讨喜
生来不讨喜 2020-11-28 04:06

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

18条回答
  •  北海茫月
    2020-11-28 04:34

    It's a problem of timeout error The request is execute twice so you have a double value

    Try to increase the timeout error request with this code :

    request.setRetryPolicy(new DefaultRetryPolicy(
    DefaultRetryPolicy.DEFAULT_TIMEOUT_MS * 2,
    DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
    DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
    

提交回复
热议问题