0

I've been looking all over the internet to see what I should use for a download manager for large files in an Android app...

It seems most people agree that Services are ideal, but on further inspection I realized that, to my understanding, there is no way to stop/pause a download once it's been started (correct me if I'm wrong).

I wonder if there is some way to download large files in Android that allows me to stop/pause the download if the user hits a button and also allows me to update a progress bar in the UI?

I also have come to understand that AsyncTask is not a good way to go if you're downloading a file that takes longer than a few seconds... I'm still not sure if I understand why that is, if anyone would like to enlighten me, I would be grateful.

JulianHarty
  • 3,178
  • 3
  • 32
  • 46
AlexW.H.B.
  • 1,781
  • 3
  • 25
  • 50

1 Answers1

1

RoboSpice is a nice framework for async network requests. (https://github.com/octo-online/robospice) I use it in tandem with Google Http Client (https://code.google.com/p/google-http-java-client/).

This allows you to easily create async tasks to download/upload data with support for caching, adding request listeners, cancelling requests etc.

RoboSpice uses a Service to perform the requests, so an Activity can fire a request, stop, and rebind a listener to the request onResume. Or even fire a new request, retrieving the result from the cache if it has already completed.

darnmason
  • 2,672
  • 1
  • 17
  • 23