I’m working on an Android app that needs a lot of API calls. I’ve build a system implementing a queuing system based on an IntentService. The thing is, I’d like to show an accurate ProgressBar updating while the IntentService is running.
One way would be to change the queuing system to a serie of AsyncTasks. I would have to show the progress using onProgressUpdate().
Another way would be to tweak the IntentService and get the progress from a background thread.
The thing is, I’d like to combine IntentService and AsyncTask nice features: make a queuing system that handles easily UI events. Is there a best way to implement that?
EDIT:
I’ve ended up using AsyncTasks instead of IntentServices. But still, if anyone has a nice pattern to share to update progress from an IntentService, feel free to add your comment.
I’d
That way you can have a single background thread to handle your work queue, and post anything you like back to the UI thread without dealing with broadcasts