Firebase存储下载不会在网络重新连接上恢复 [英] Firebase Storage Downloads Doesn't Resume on Network Reconnection

查看:329
本文介绍了Firebase存储下载不会在网络重新连接上恢复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

故事

我正在使用Firebase存储上传和下载文件。 上传几乎可以完美运行,如果设备在几分钟内丢失了互联网连接,上传将停止,但一旦连接恢复,它将自动恢复。



问题

我曾经期待下载的确切行为。但是这样做不行。如果我的设备失去了互联网连接,下载将突然失败,并且不会在连接几秒后自动返回。



这是正常行为吗?我错过了什么吗?



任何帮助他都会高度赞赏。

编辑



完全是这个错误,

  com.google.firebase.storage.StorageException:发生未知错误,请检查HTTP结果代码和服务器响应的内部异常。 

读取错误:ssl = 0xb7e7a510:系统调用期间的I / O错误,连接超时
javax.net.ssl.SSLException:读取错误:ssl = 0xb7e7a510:期间的I / O错误系统调用,连接超时
at com.android.org.conscrypt.NativeCrypto.SSL_read(Native Method)
at com.android.org.conscrypt.OpenSSLSocketImpl $ SSLInputStream.read(OpenSSLSocketImpl.java:699 )
at com.android.okio.Okio $ 2.read(Okio.java:113)
at com.android.okio.RealBufferedSource.read(RealBufferedSource.java:48)
at com .android.okhttp.i nternal.http.HttpConnection $ FixedLengthSource.read(HttpConnection.java:446)
at com.android.okio.RealBufferedSource $ 1.read(RealBufferedSource.java:168)
at java.io.InputStream.read (InputStream.java:162)
在com.google.firebase.storage.FileDownloadTask.run(未知源)
在com.google.firebase.storage.StorageTask $ 5.run(未知源)
在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)$ b $在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:5 87)
在java.lang.Thread.run(Thread.java:818)


解决方案

您可以使用具有下载网址(reference.getDownloadUrl())的Android下载管理器来管理强大的下载。



请参阅:
完成Android下载管理器



<我们将在即将发布的版本中改进这一处理。
另外我建议使用许多图像下载SDK(如Glide https://github.com/bumptech/滑翔


The Story

I am using Firebase Storage to upload and download files. The upload works almost perfectly and if the device looses internet connection for a few minutes, then the upload stops, but it automatically resumes once the connection is back.

The Problem

I was expecting this exact same behaviour for the downloads as well. But it doesn't work like that. If my device looses internet connection, the downloads fails abruptly and doesn't automatically once the connection is back after a few seconds.

Is this the normal behaviour? Am I missing out on something?

Any help would he highly appreciated.

EDIT

This is the error exactly,

com.google.firebase.storage.StorageException: An unknown error occurred, please check the HTTP result code and inner exception for server response.

Read error: ssl=0xb7e7a510: I/O error during system call, Connection timed out
                                                                           javax.net.ssl.SSLException: Read error: ssl=0xb7e7a510: I/O error during system call, Connection timed out
                                                                               at com.android.org.conscrypt.NativeCrypto.SSL_read(Native Method)
                                                                               at com.android.org.conscrypt.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:699)
                                                                               at com.android.okio.Okio$2.read(Okio.java:113)
                                                                               at com.android.okio.RealBufferedSource.read(RealBufferedSource.java:48)
                                                                               at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.read(HttpConnection.java:446)
                                                                               at com.android.okio.RealBufferedSource$1.read(RealBufferedSource.java:168)
                                                                               at java.io.InputStream.read(InputStream.java:162)
                                                                               at com.google.firebase.storage.FileDownloadTask.run(Unknown Source)
                                                                               at com.google.firebase.storage.StorageTask$5.run(Unknown Source)
                                                                               at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                               at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                               at java.lang.Thread.run(Thread.java:818)

解决方案

You can manage robust downloads using the Android Download manager with the download url (reference.getDownloadUrl()).

See: Android download manager completed

We'll improve this handling in an upcoming release. Also I recommend using the many image download SDKs (like Glide https://github.com/bumptech/glide)

这篇关于Firebase存储下载不会在网络重新连接上恢复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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