I have requirements where jobs are required to be done in background.I read about the best practices for background jobs at Android website.
Here its written
the Android framework offers several classes that help you off-load operations onto a separate thread running in the background. The most useful of these is IntentService.
I also came across something named as AsyncTask where they mentioned
This class allows to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers.
I was not able to decide which one should I use.Also I may have to consider the fact that android eventually kill apps when it wants to reclaim memory.
Now I am left with the questions :-
- What are the deciding factors for choosing between AsyncTask and IntentService ?
- Which one will be the best choice considering android's memory reclaim nature ,so that the app's background job should be done gracefully?
Please help me with it..