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

how to check received bytes or data continuously until data received fully in volley #396

Closed
Hax4us opened this issue Feb 14, 2021 · 1 comment

Comments

@Hax4us
Copy link

Hax4us commented Feb 14, 2021

i want to download a video and everything is working fine but what i want to do is "check received or downloaded data/video continuously until full data or video download".

Check means i want to track how many bytes i/volley received

is it possible ? if yes then how ?

@jpd236
Copy link
Collaborator

jpd236 commented Feb 15, 2021

The answer depends on the underlying HTTP stack you're using. As of #328, you can extend HurlStack and override createInputStream to return a FilterInputStream which can monitor when bytes are read and dispatch callbacks along the way to the request. See HurlStackTest for an example of this. (This is not yet in an official release, so you'd need to use a SNAPSHOT build or build from source).

That said, downloading large files like videos with Volley is generally an anti-pattern. Please see https://github.com/google/volley/wiki/Frequently-Asked-Questions#why-doesnt-volley-support-large-downloadsuploads and consider using a more robust framework to avoid having to load the full file contents into memory and to support resumable downloads, for example.

@jpd236 jpd236 closed this as completed Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants