[英]What is cleared when a user kills an app (android)?
When a user manually kills an app, what data is cleared? 当用户手动终止应用程序时,会清除哪些数据?
I have a bit of functionality that only properly clears the data on app kill and reopen, so clearly the system is clearing some data that I am missing. 我有一些功能只能在清除应用程序并重新打开时正确清除数据,因此很明显,系统正在清除一些我丢失的数据。
Basically, I want to know what sort of delete/clear data is called programatically so that I can try and figure out what is being kept around on close/reopen that doesn't stick around for kill/reopen. 基本上,我想知道以编程方式调用哪种类型的删除/清除数据,以便我可以尝试找出关闭/重新打开时保留的内容,而这些内容不会被杀死/重新打开。
EDIT: I am basically trying to find out the difference between finish() of an activity that contains a webview and force-close/reopen 编辑:我基本上是想找出包含webview和强制关闭/重新打开的活动的finish()之间的区别
When you force close, the app will be completely removed from the memory. 当您强行关闭时,该应用将从内存中完全删除。 For example, all services will be closed, any static variables that you might be holding, everything will be cleared.
例如,所有服务都将关闭,您可能持有的所有静态变量,将清除所有内容。 However, persistent storage such as SharedPreferences will not be affected.
但是,诸如SharedPreferences之类的持久性存储将不受影响。 Every value that was committed before the force closure of the app will be remain as they were.
在强制关闭应用程序之前提交的每个值都将保持原样。
Also, you cannot expect the lifecycle methods to be called on Force Close. 同样,您不能期望生命周期方法在强制关闭时被调用。 So if you're doing anything inside onDestroy of a Service or an Activity, that'll most likely fail since the method is never called.
因此,如果您在服务或活动的onDestroy内执行任何操作,则很可能会失败,因为永远不会调用该方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.