简体   繁体   English

用户杀死应用程序(android)后会清除什么?

[英]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.

相关问题 用户杀死应用程序后保存状态,Android - Save state after user kills app, Android 用户杀死应用后,Android重新创建活动 - Android recreating activity after user kills the app Android-用户卸载Android App时,是否会自动清除App Cache + App Data? - Android - Are App Cache + App Data automatically cleared when user uninstalls an Android App? 当Android终止活动并再次启动活动时,是否可以完全重新启动应用程序? - Is there a way to restart completely the app when Android kills the activity and the user starts it again? 重新安装android应用后,sharedPreference是否被清除? - Is sharedPreference cleared when an android app is reinstalled? 当某人关闭或杀死某个应用时代码会发生什么变化? - What happens to the code when someone closes or kills an app? 当 Android 需要 memory 并杀死您的应用程序时,如何保留数据? - How to persist data when Android needs memory and kills your app? 即使运行前台服务,Android 7.0也会终止应用程序 - Android 7.0 Kills App Even When Foreground Service is Running 当Android杀死一个应用程序时,一个功能可以中途停止吗? - When Android kills an app, can a function be stopped halfway? Android杀死了我的phonegap应用 - android kills my phonegap app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM