如何让我启动了由操作系统被杀死?让我、被杀、操作系统、启动了

2023-09-06 09:18:01 作者:ˉ 独家记忆

我工作的第三方Android启动的一个项目。我发现在后台运行时,它常常被杀害的操作系统,即使它是默认的启动器。

I am working on a project of 3rd-party Android Launcher. I find it being killed often by OS when running in background, even it is the default Launcher.

操作系统会杀了很多的应用程序时,可用内存是不够的,我是客人为什么我的启动被杀害的原因。

OS will kill many apps when available memory is not enough, I guest that the reason why my Launcher is killed.

所以我的问题是我应该怎么办,以减少被杀害的机会呢?

So my question is what should I do to decrease the chance of being killed ?

推荐答案

没有。你应该找到一种方法来处理,其中OS杀死你的进程时,使用的是哈克的方法来保持它在内存中是坏的,不好的设计,并可能导致各种不同设备上的问题。

Nothing. You should find a way to handle the event where the OS kills your process, using a hacky approach to keep it in memory is bad, bad design and could lead to all sorts of issues on different devices.

您真的应该甚至不关心系统杀死你的过程中,发射器应处理的意图,要么如果present恢复或启动,如果杀了。

You really shouldn't even care that the system is killing your process, the launcher should handle an intent and either resume if present or start if killed.