通过WorkManager恢复Firebase上传任务时出现StorageException

时间:2019-02-14 12:28:52

标签: firebase firebase-storage android-workmanager

我正在通过WorkManager运行Firebase上传任务。从UploadTask进行常规进度更新时,我将会话uri保存在共享首选项中。

当我关闭Internet时,Firebase会自行处理方案,并在重新打开Internet时恢复上传任务。

但是,当我在Firebase上传文件并打开电源时关闭手机电源时,工作管理器再次重新启动,并尝试使用上次保存的会话uri恢复先前的Firebase上传任务,并给出以下异常:

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
E/StorageException: The server has terminated the upload session
    java.io.IOException: The server has terminated the upload session
        at com.google.firebase.storage.UploadTask.recoverStatus(com.google.firebase:firebase-storage@@16.0.5:354)
        at com.google.firebase.storage.UploadTask.run(com.google.firebase:firebase-storage@@16.0.5:200)
        at com.google.firebase.storage.StorageTask.lambda$getRunnable$7(com.google.firebase:firebase-storage@@16.0.5:1106)
        at com.google.firebase.storage.StorageTask$$Lambda$12.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:798)

每当我从Firebase Upload Task中收到进度回调时,都会保存我的会话uri。也许这就是手机关机时我没有得到最新手机的问题。

如果有人可以在此处帮助您确定问题,将不胜感激。

0 个答案:

没有答案