Do httpClient required AsyncTask wakeLock?

I perform in httpClient AsyncTask, but not before another AsyncTask used to generate some of the data that can be time consuming. If the unit will sleep up to perform HTTPClient, what will happen? Do I need to request wakeLock httpClient requests?

+4
source share
1 answer

If the device goes into sleep mode, your work is called onPause() . If you do not cancel or complete a background job in some bizarre way, nothing happens to him. AsyncTask run on a separate thread than the application's main application, so nothing can stop them. Someday.

I did not understand your design: what is the purpose of two separate AsyncTask s? If the data collection for the HTTP-request fill consumes time, you should use one AsyncTask and do everything inside doInBackground() , so that there was no race conditions. Otherwise, you have to perform tasks or execute a chain of a second in the first, and it does not sound right.

HTTP-client - it's just a library of sockets is not a mythological beast :)

0
source

All Articles