react-native-background-downloader
react-native-background-downloader copied to clipboard
Progress callback never called
Is this a bug report, a feature request, or a question?
Bug report
Have you followed the required steps before opening a bug report?
(Check the step you've followed - put an x character between the square brackets ([]).)
- [x] I have reviewed the documentation in its entirety, including the dedicated documentations :books:.
- [x] I have searched for existing issues and made sure that the problem hasn't already been reported.
- [x] I am using the latest plugin version.
Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?
Android
Is the bug related to the native implementation? (NSURLSession on iOS and Fetch on Android)
No
Environment
Environment: React: 16.8.3 React native: 0.59.10 react-native-background-downloader: 2.3.2
Target Platform: Android (9.0)
Expected Behavior
When i launch a download, i want to get the percents of currently downloaded bytes to fill a progress bar with the progress() method
Actual Behavior
The progress method seems never called, whatever the file i want to download (mp3 files with size like 20mo), but both begin() and done() work correctly.
Steps to Reproduce
RNBackgroundDownloader.download({ id: duration._id, url, destination: ${RNBackgroundDownloader.directories.documents}/${duration._id}/${user.user.language}.mp3 }) .begin((expectedBytes) => { console.log(Going to download ${expectedBytes} bytes!); }) .progress((percent) => { console.log('Progress:', percent) this.setState({ downloadProgress: percent }) }) .done(() => { console.log('Dowloaded') this.setState({ durationToDownload: null, downloadProgress: 0 }) }) .error((error) => { console.log('Download canceled due to error: ', error); });
Also facing this issue on Android
It may be that the file is not large enough. I had the same problem for a 10MB File, but it's working fine for a 80 MB file.
I think if you want a fine grained progress update, other libraries may support your need better. Alternatively the plugin could report the progress a bit more often (ideally this would be a configuration option).
Still: i run into the same problem, when coming back to an existing download. It never calls done() or progress() either...
Hi,
This problem exists with 30mb files (mp3 non compressed). I don't think it's a file size problem cause progress works fine without background process.
I'm also having that sometimes. And then when reattaching the task the progress is already >~60%
Any updates for this issue?
Same issue here (Android)
Same Have you found solution, guys?