-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert AsyncTask to IntentService #969
Conversation
constructor should be empty constructor
I sent this pr several days ago. Any comments/suggestions on the changes? |
Hi @yulin2, Thanks for your contribution. Is it your first contribution in the OwnCloud Project? I've been searching your nickname in the developers list and I have not found it. If you haven't signed the Contributor Agreement, please send it ( https://owncloud.org/contribute/agreement/) to @karlitschek. We can't merged your PR without this agreement. On the other hand, could you update your branch with the last version of the code? It is better to do the code review easily. A question, why did you select IntentService instead of AsyncTaskLoader as in your PR #892? Thanks again |
Need to think a bit about this. Not sure that replacing At first sight, I see a possible problem with returning results through Besides, we'd like reduce the number of |
Thanks a lot for your contribution! Alternatively you can add a comment here where you state that this contribution is MIT licensed. Some more details about out pull request workflow can be found here: http://owncloud.org/code-reviews-on-github/ |
Need to check if this still relevant in the context of new architecture #2351 |
|
Hey owncloud-android developers, I'm doing research on Android async programming, particularly on
AsyncTask and IntentService. AsyncTask can lead to memory leak and losing task result when GUI is recreated during task running (such as orientation change). This article describe the problems very well.
We discussed with some Android experts and they agree with this issue, and claim that AsyncTask can be considered only for short tasks (less than 1 second). However, using IntentService (or AsyncTaskLoader) can avoid such problems since their lifecycles are independent from
Activity
.For example, in
LogHistoryActivity
, even if you useWeakReference
for a text view in the AsyncTask,you still hold a strong reference to the activity itself, which can lead to the problems described above. (I also opened a related pr before #892)
I refactored three AsyncTasks in
owncloud-android
to IntentService, with the help of a refactoring tool we developed. Do you think using IntentService is better in these three activities, and merge this pr?