Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android downloadFile completely freezes the app #443

Open
mdrbohlav opened this issue Feb 16, 2018 · 4 comments
Open

Android downloadFile completely freezes the app #443

mdrbohlav opened this issue Feb 16, 2018 · 4 comments

Comments

@mdrbohlav
Copy link

mdrbohlav commented Feb 16, 2018

When I start downloading large file the app completely freezes.

My config is really simple:

const config = {
  fromUrl: url,
  toFile: path,
  progressDivider: 1,
  begin: ({ contentLength }) => {
    processProgress(contentLength);
  },
  progress: ({ contentLength, bytesWritten }) => {
    processProgress(contentLength, bytesWritten);
  },
};

const task = RNFS.downloadFile(config);

Android: 6.0 and 7.1.1, both emulated with remote debugging on
RN: 0.51.0
RNFS: 2.9.10

@itinance
Copy link
Owner

At zizzle we use this function to download large files and even show a progressbar at the bottom of the screen, while the user can navigate between different views without and freeze.

Seems that something different is causing your issue.

@mdrbohlav
Copy link
Author

There is nothing else happening in the moment of the download. But I found for some reason on Android the file size of a specific file is not known (did not check if the header 'content-length' is set but it works fine on iOS) which means the progressDivider has no effect and it sends progress notification each few ms.

@Kendysond
Copy link

For me, removing my download progress function resolved the freeze on Android. I guess it's because redux keeps updating the state at each progress increment. Sad that android users can't see an actual progress view, but I guess it's cool.

@sergibel
Copy link

Option progressDivider do not work if the server does not provide response content length. To reduce the frequency of callbacks, the option progressInterval defines how often the progress is returned, see PR #717

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants