I've built an app that was working fine and has been tested on multiple devices (about 20 different ones), but now android 4.4.2 users (1 nexus tablet and 3 HTC One phones) are reporting issues.
I have traced the problem and found that onPreExecute
and onPostExecute
are not being called on these devices.
My code looks (simplified) like this:
public class MyTask extends AsyncTask<Void, Void, Boolean> {
/** [...] **/
@Override
protected void onPreExecute() {
Log.d(TAG, "onPreExecute executed");
/** [...] **/
};
@Override
protected Boolean doInBackground(Void... arg0) {
Log.d(TAG, "Task running in background");
return client.loadUrl();
}
@Override
protected void onPostExecute(Boolean isOpen) {
Log.d(TAG, "onPostExecute executed");
/** [...] **/
}
}
I'm running the task calling the execute() method.
Like I said: I can see in the logs that the 'Task is running in the background', but only on the 4.4.2 devices I notice that the log-lines of the onPre- and onPostExecute are missing.
Does someone know if this behaviour has changed? I couldn't find anything about it in the documentation.
Or better: does someone know how to fix this?