views:

25

answers:

1

I am trying to implement a RESTful API in which I have to upload files that are relatively large for a mobile platform. The upload could take anywhere from 30 seconds to 5 minutes.

I would like my application to be completely usable while the upload takes place. I've been doing some research and I've come across a few methods from which I can't decide which is the correct solution to my problem.

These are the two things I have come across.

  1. Using an IntentService -- handles the worker thread so I don't have to.
  2. Using my own type of Service-- still need to implement an AsyncTask to handle the large process.
  3. Implement an AsyncTask in a singleton file that would allow me to do all the work there but without using the service class.

My question is which method is the best -- if one isn't listed but is a more apt solution to my problem then I would appreciate suggestions.

After researching all these methods I am still also confused on one thing. Lets say I upload a 2MB files, but I want to know when it is done. For example, lets say I have a service that uploads an image and returns and imageID -- I need to be able to know when that service returns an imageID -- process that and then move on to the next upload until the rest are finished.

As always, thanks in advance.

EDIT: I forgot to specify that while uploading I want the app to be usable-- that means that I can switch activities and still have the same service run.

A: 

I used IntentService. It extends service so it basically has all the functions of the normal service, expect that it handles the threading for me so I don't have to worry about that. Its working very well at the moment.

hwrdprkns