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

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

问题描述

如果一个Android凌空post请求失败,因为网络的损失,将Android的凌空重试后门柱的网络连接会自动恢复?它会解雇所有的请求报文,等待连接被重新建立或只是触发一个错误并停止?

如果Android的凌空不重试之后重新建立连接,看来我将不得不创建逻辑,这样我有每当连接丢失了一个额外的队列,并且将重试连接时的状态变化。

解决方案
  

如果一个Android凌空post请求失败,因为网络的损失,将Android的凌空重试后门柱的网络连接会自动恢复?

没有,也不会。我可能甚至可以根据您的应用程序所需的。

  

它会触发所有的请求报文,等待连接   重新建立或只是触发一个错误并停止?

这只是抛出一个错误。是的,你应该写这样的逻辑自己。

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?

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.

解决方案

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的凌空处理暂时丧失网络连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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