volley由于网络访问比较慢,导致访问两次的现象

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.


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);
这样子就可以解决了。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值