Android Volley 如何处理暂时失去网络连接? [英] How does Android Volley handle temporarily loss of network connection?

查看:40
本文介绍了Android Volley 如何处理暂时失去网络连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果Android Volley post请求因网络丢失而失败,Android Volley会在网络连接自动恢复后重试post吗?它会触发所有请求尝试、等待重新建立连接还是只是触发错误并停止?

If an Android Volley post request fails due to network loss, will Android Volley retry the post after the network connection is restored automatically? Will it fire all of the request attempts, wait for connection to be reestablished or simply trigger an error and stop?

如果 Android Volley 在重新建立连接后不重试,似乎我必须创建逻辑,以便在连接丢失时有一个额外的队列,并且在连接状态发生变化时重试.

If Android Volley doesn't retry after a connection is reestablished, it seems I will have to create logic so that I have an extra queue for whenever the connection gets lost, and that will retry whenever connection state changes.

推荐答案

如果Android Volley post请求因网络丢失而失败,Android Volley会在网络连接自动恢复后重试post吗?

If an Android Volley post request fails due to network loss, will Android Volley retry the post after the network connection is restored automatically?

不,不会.根据您的申请,我什至可能不被需要.

No, it won't. I might not even be desired depending on your application.

它是否会触发所有请求尝试,等待连接到重新建立还是简单地触发错误并停止?

Will it fire all of the request attempts, wait for connection to reestablish or simply trigger an error and stop?

它只是抛出一个错误.是的,您应该自己编写这种逻辑.

It simply throws an error. And yes, you should write this kind of logic yourself.

这篇关于Android Volley 如何处理暂时失去网络连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆