Looking at the source code for the stock Calendar app, Google uses an IntentService to do the content provider operations for the database. Is there an advantage to using an IntentService rather than a AsyncQueryHandler?
I thought that since a Handler is tied to the UI, if the activity gets paused or stopped, the Handler would also get paused. However, this doesn't seem to be the case: I created a simple content provider and AsyncQueryHandler that do nothing but run through a long for loop. When I launch other apps or kill the activity, the for loop still runs.
So is the advantage of using an IntentService for asynchronous CRUD operations that the service (being a service) has less of a chance of getting killed?
Update: Part of my confusion is how a handler relates to an activity's lifecycle. From my experiment, it seems that it's independent.
Also, for those not familiar with the stock Calendar app source code, the way it works is that to do a CRUD, it adds the operation to a queue along with a reference to a handler. Then it starts the intent service which pops the queue and does the CRUD. When it's finished, it invokes the handler via Message.sendToTarget().
So what does that extra complexity buy us?