So I have gone through the developer site: https://developer.android.com/training/articles/perf-anr.html
So I came to a conclusion :avoid intensive tasks via worker thread. So should use Asyctask, Intent Service and Handlers.
Also these three tasks have some limitations:
Asynctask:
- It could not be used for long running operations
- Cannot be used when using multiple asynchronous operations and and the need for UI change, will become more complicated
IntentService
- Works requests run sequentially.
- Operation running cannot be interrupted
Now keeping this in mind, as Handler and IntentServices could be used for long running operation.
can anybody help me with the difference between Handler and IntentService ? Like when should I use Handler and when IntentService and which is better to use?
Also what is the best approach to run request asynchronously?