I m running a queue where i m downloading videos and for que to work properly in need to get the postExecute of AsyncTask called mandatorily..or there must b an event where i can get when my asynctask is getting killed by the processor which says “No more Background Tasks”..Low memory..OnCancelled not getting called too…Any help???
@kdehairy Intent Service??? Okk actually i need to update my UI..For example i have a video being downloaded which started in asynctask and i keep track of the chunk and accordingly update my custom progressBar if the user destroys the activity m not cancelling my ansynctask till my work is done..i keep track of asynctask..if for some reason my asynctask stops even if its in background…it agains ques the task..which is done by service…what i m saying is even i dont know my asynctask is queued from service or app…but i just kip track of asyncatsks being queued..and push and pop from stack..asynctask postexecute refreshes my view…like in if asynctask is running from service i check in postExecute if my UI screen is visible…and than i call new Intent..with Flags SingleTop and New Task and thus i can refresh my progressBar..Can i update my UI using IntentService..will it run on UIThread or worker thread..
Can u provide me an example…???
Thanks Kdehairy
If it is critical for you to handle the life cycle of your process, then it is better to use a service.
AsyncTask is not a system component (Services are).
UPDATE:
IntentServicewith your own implementation.to update the UI you can use boradcasts. as follow:
Here we are sending a broadcast using the
LocalBroadcastManagerbecause we want to keep this broadcast private to the application.in your Activity:
If you find anything unclear, please let me know.