react-native-background-downloader icon indicating copy to clipboard operation
react-native-background-downloader copied to clipboard

Progress callback never called

Open GregoryBabonaux opened this issue 6 years ago • 7 comments

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 ([]).)

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); });

GregoryBabonaux avatar Nov 22 '19 15:11 GregoryBabonaux

Also facing this issue on Android

warefhaque avatar Dec 11 '19 19:12 warefhaque

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...

AnagramEngineering avatar Jan 29 '20 07:01 AnagramEngineering

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.

GregoryBabonaux avatar Jan 29 '20 07:01 GregoryBabonaux

I'm also having that sometimes. And then when reattaching the task the progress is already >~60%

edferreira avatar Feb 07 '20 19:02 edferreira

Any updates for this issue?

atozICT20 avatar Jun 29 '20 19:06 atozICT20

Same issue here (Android)

tavindev avatar Oct 12 '20 16:10 tavindev

Same Have you found solution, guys?

kesha-antonov avatar Jan 21 '21 12:01 kesha-antonov