0

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 or am I missing something?

EDIT

This is the error,

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)
Kalpesh
  • 4,020
  • 4
  • 18
  • 27
Aritra Roy
  • 15,355
  • 10
  • 73
  • 107
  • plz ref this link: http://stackoverflow.com/questions/37499262/firebase-storage-handling-network-interruptions-when-download-in-progress?rq=1 – Damini Mehra Aug 17 '16 at 10:04
  • Thanks for the reference. But my download instantly fails if the connection is lost. It doesn't retry at all. What should be the problem? – Aritra Roy Aug 17 '16 at 10:09
  • @DaminiMehra I have edited the question with the exact exception thrown immediately when the internet connection is lost. Can you please help? – Aritra Roy Aug 17 '16 at 12:54
  • Plz send this issue to firebase team. they people are help for this. or chk this link: https://firebase.google.com/docs/auth/android/anonymous-auth#authenticate-with-firebase-anonymously – Damini Mehra Aug 22 '16 at 03:29

1 Answers1

0

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)

Community
  • 1
  • 1
Benjamin Wulfe
  • 1,705
  • 13
  • 9