I am having trouble resuming an UploadTask from the paused state. I am able to successfully upload a video if I let it finish without attempting to pause the upload. According to Firebase Storage Android Documentation you can use the resume
function to resume an UploadTask that was paused previously. Unfortunately when I try and execute the sample myself, I observe a
04-11 15:20:36.285 9432-9660/io.pristine.firebasesample E/UploadTask: Unable to read bytes for uploading java.io.IOException: Stream closed at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:162) at java.io.BufferedInputStream.read(BufferedInputStream.java:325) at com.google.android.gms.internal.zzbtu.zzqP(Unknown Source) at com.google.firebase.storage.UploadTask.zzacR(Unknown Source) at com.google.firebase.storage.UploadTask.run(Unknown Source) at com.google.firebase.storage.StorageTask$8.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761)
And another immediately after that:
04-11 15:20:36.285 9432-9660/io.pristine.firebasesample E/StorageException: StorageException has occurred. An unknown error occurred, please check the HTTP result code and inner exception for server response. Code: -13000 HttpResult: 200
HttpResult 200 seems normal and -13000 looks like ERROR_UNKNOWN
Basic steps to reproduce in case the github repo goes down:
- Authenticate with firebase authentication (not sure if this is needed)
- Copy a binary file from assets (you can probably read from sd card if you want)
- Start an UploadTask by using putFile(Uri, StorageMetadata)
- Pause the uploadTask by calling UploadTask.pause() after the upload starts and before it finishes
- Resume the upload task in a second or two once you verify it paused by calling UploadTask.resume()
- Observe a Storage Exception
I'm using firebase-database:10.2.1
, firebase-auth:10.2.1
& firebase-storage:10.2.1
as the only dependencies, and tested on several devices with google play services support. (Google Play Availability: SUCCESS
)
The goal of getting this feature to work is to allow users of the application to manually pause and resume uploads. (Some are on wi-fi hotspots that are metered and not visible to the android OS that i'm aware of)