Closed hedi-ghodhbane closed 2 months ago
The batch upload feature lives on the Dart side, which means that it is meant for use when the app is in the foreground - when the app is suspended your callbacks will not be called. If the functionality you need requires true background processing, then you need to enqueue
your tasks individually, monitor progress using a registered central listener, and implement resumeFromBackground
. See here for more detail.
The batch functionality is useful if you have smaller files, or if you are less concerned about progress/completion tracking. For more robust implementation you need to implement this more complex approach.
I don't want to upload each file individually as we have a use-case where users can upload up to 20 files at once. Enqueuing one by one would take too much time. The upload batch works fine for this case, it uploads in parallel. Can this be done otherwise?
Understand, but all the batch upload function does is schedule each upload as a background task, and provide some monitoring. It is meant for use in the foreground. What I recommend you do is schedule each task in your batch yourself, using enqueue
, which accomplishes your goal of allowing users to upload 20 files at once, in parallel. The only difference is that now
resumeFromBackground
functionality as described in the documentationTo the user, this is the same experience. For you, it's a bit more code, but avoids the issues that you raised.
Thank you @781flyingdutchman for your quick & precise answers!
Describe the bug I'm using Background_downloader to upload pictures. I'm using uploadBatch for that. However, i started getting constant feedback from clients on iOS and Android that sometimes they try to upload one or multiple picture but nothing happens. I don't get any logs that the task is Completed/Failed and no TaskStatus update nor task progress.
To Reproduce Steps to reproduce the behavior: It's not consistent.
Expected behavior Should have a way to upload all the time or at least have a log when something unexpected happens. Maybe the os killed the task with no notification? Logs No logs
Code If possible, paste in the code snippet where you interact with the package:
Additional context Sometimes clients say it appears of 15 minutes and sometimes after 6 hours.