We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
NewUser
9 years agoNew member | Level 2
[Android] Effective way to download files
Hi. In my app I need to download a lot of small files (0.1 - 5MB). For example now I have got 50 files and I download them by using this code foreach:
FileOutputStream fOut = null;
File file = new File(localPATH, localName);
if (file.exists())
file.delete();
file.createNewFile();
fOut = new FileOutputStream(file);
dbxClient.files().downloadBuilder(remotePATH).start().download(fOut);
fOut.flush();
fOut.close();But I think this way isn't good. Download process take from 1 to 2.5 minutes (size of all files = 8MB, my internet speed = 40Mbps).
Can someone tell me what should I use for increase download speed?
Thanks for answers.
Your connection speed to Dropbox depends on the routing you get between your ISP and our servers, and may be slower than your ISP's rated speeds. Sometimes resetting or retrying your connection gets you a different route and better speeds, but that is outside of our control. Some ISPs also throttle sustained connections so if you see an initial high connection speed followed by lower speeds, that could be the reason. The API can't offer a way to control that unfortunately.
That said, in your case, the effective speed you're seeing may be due to the fact that you're trying to download many smaller files. In this example, you need to make 50 distinct API calls, each of which comes with some amount of overhead, reducing the overall speed. Unfortunately, the API doesn't offer a good solution to that, but I'll be sure to pass this along as a feature request for a batch download call.
1 Reply
- Greg-DB9 years ago
Dropbox Community Moderator
Your connection speed to Dropbox depends on the routing you get between your ISP and our servers, and may be slower than your ISP's rated speeds. Sometimes resetting or retrying your connection gets you a different route and better speeds, but that is outside of our control. Some ISPs also throttle sustained connections so if you see an initial high connection speed followed by lower speeds, that could be the reason. The API can't offer a way to control that unfortunately.
That said, in your case, the effective speed you're seeing may be due to the fact that you're trying to download many smaller files. In this example, you need to make 50 distinct API calls, each of which comes with some amount of overhead, reducing the overall speed. Unfortunately, the API doesn't offer a good solution to that, but I'll be sure to pass this along as a feature request for a batch download call.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!