Android low memory killer & application back stack

本小妞迷上赌 提交于 2021-02-07 20:57:50

问题


Android system may decide to remove an application process when the system is low on memory, so to reclaim resources for more important work ( ie. to start a service belongs to another application ). However, I couldn't be sure if it's possible for the Android system to remove ONLY application task ( back stack ) without touching the corresponding app process?

If this is possible, it's also possible the system destroys the back stack activities by performing a call to each onDestroy() callback. So, how can we catch this task removal just like we catch it in a Service ( through onTaskRemoved )

Thanks


回答1:


When Android wants to reclaim resources (or just because Android likes to tidy up), it will usually just kill off any OS processes that are not hosting foreground activities or foreground services. Android does this by actually killing the OS process, therefore onDestroy() will NOT be called on any components that are active in those OS processes. You will not be warned about this, so there is no way to "catch" this behaviour.



来源:https://stackoverflow.com/questions/38953868/android-low-memory-killer-application-back-stack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!