Aqeeb Pathan
Aqeeb Pathan

Reputation: 33

How to boost the speed of downloading files in the background in Android?

I am developing an app (for both Android and iPhone). Actually, in my app I have to download lot of videos in background (using a background service, IntentService) as well as I have a screen showing the progress of downloads (using an Activity which has UI for showing download progress). But I don't know why the download speed is too less as compared to download speed for the same app in iPhone.

Also, after each download of video, I am marking that video as downloaded in the database. And this happens for all videos.

Is the database calls a problem for slow downloads of files in android? Since the same functionality does not affect the download speed of files in iPhone.

Upvotes: 1

Views: 3486

Answers (2)

Maikel Bollemeijer
Maikel Bollemeijer

Reputation: 6565

Increase the Byte size of your inputstream

Update:
Take a look here

Upvotes: 1

Nimooli
Nimooli

Reputation: 89

You could try to implement some sort of download accelerator which downloads a single file by splitting it in segments and using several simultaneous connections to download these segments from a the server. First you should check if the server Accepts byte-ranges and then specify byte-ranges to download in a multi-threaded way. At last you just merge back the segments into a complete file.

Look into these documents for more info:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.5

Page 128: http://www.ietf.org/rfc/rfc2068.txt

Also look up Java API URLConnection.setRequestProperty

However, I think the slow download is mostly because of your network bandwidth and server's upload speed.

Upvotes: 1

Related Questions