0

With a little of bit research on Intentservice, AyncTask and Handler, I understand that all three do background processing. But what I am unable to understand is how each of them is implemented internally ?

Can someone throw some light or point me in the right direction. Any pointers or suggestion is highly appreciable.

Sunny
  • 14,522
  • 15
  • 84
  • 129
Integrity
  • 34
  • 5

2 Answers2

1

Android is open source platform, therefore you need to fetch its source code and lurk in related files to inspect all internal details you are after.

Here's how to download the sources

or

see Where can I find Android source code online? question.

Community
  • 1
  • 1
Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
0

It really depends on what you need to achieve. In my experience, I have worked with IntentServices for background processing, no matter how long or short the work will be. What is great with IntentServices is that it deploys a worker thread for every job you schedule on it. You can schedule n number of tasks and the IntentService will execute each at a time on its onHandleIntent method and when done, it will automatically shut down. To get a response back to the activity when job is finished, you could implement Broadscast or ResultReceivers.

I haven't worked enough with Handler or AsyncTask but from what I have read and understand, they are better used when the work you schedule them does not require to finish or is not high priority if the dispatching Activity finishes.

Hope it helps.

Andres
  • 400
  • 3
  • 8