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

onDestroy方法中必须调用MMKV.onExit()方法嘛? #57

Closed
duanyuGit opened this issue Sep 30, 2018 · 5 comments
Closed

onDestroy方法中必须调用MMKV.onExit()方法嘛? #57

duanyuGit opened this issue Sep 30, 2018 · 5 comments

Comments

@duanyuGit
Copy link

onDestroy方法调用MMKV.onExit是为了清除缓存嘛?还有其它作用嘛?如果不调用有什么问题?

@ysbing
Copy link
Contributor

ysbing commented Sep 30, 2018

Called when the process leaves, it can immediately synchronize the data to the file and empty the cache data for that process.

@duanyuGit
Copy link
Author

Called when the process leaves, it can immediately synchronize the data to the file and empty the cache data for that process.

如果不调用,有没有问题?

@lingol
Copy link
Collaborator

lingol commented Sep 30, 2018

It's quit OK not calling onExit() in onDestroy. Data won't lose if there's no immediate device shutdown.
But it's recommended. Shit happens, you know.

@vincentssn
Copy link

But how to know the process is leaving? Calling in onDestroy() in every Activity and Service?

@lingol
Copy link
Collaborator

lingol commented Jan 22, 2019

I hate to repeat myself.

It's quite OK not calling onExit() in onDestroy. Data won't lose if there's no immediate device shutdown.

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

4 participants