Skip to content
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

SugarApp.onTerminate will never be called! #106

Closed
alopix opened this issue Jun 20, 2014 · 3 comments
Closed

SugarApp.onTerminate will never be called! #106

alopix opened this issue Jun 20, 2014 · 3 comments

Comments

@alopix
Copy link

alopix commented Jun 20, 2014

I saw that the SugarApp class relies on the onTerminate lifecycle method.
You can just remove the code from inside this method as it will never be called:

This method is for use in emulated process environments. It will never be called on a production Android device, where processes are removed by simply killing them; no user code (including this callback) is executed when doing so.
from Android Developer

@whoshuu
Copy link
Collaborator

whoshuu commented Jul 4, 2014

Nice find! Just to clarify, when you say "emulated process environments", does that include the emulator that comes, for instance, with Eclipse or Android Studio? Or even something like Genymotion? Would appreciate some feedback on this.

@alopix
Copy link
Author

alopix commented Jul 4, 2014

The official Android Emulator is one of those "emulated process environments".
I do not know about Genymotion and external other products though, sorry.

@whoshuu
Copy link
Collaborator

whoshuu commented Jul 4, 2014

It would seem like the best thing to do is to leave it there then. Since there are some environments where the database is not automatically cleaned up and released, then having it there could have some benefit without doing any harm. At the very least though, I hear what you're saying, and there should be a comment there telling the developer that onTerminate is only called in emulation environments. I'll close this issue when that comment is added to master.

@whoshuu whoshuu closed this as completed in e2bb783 Jul 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants