任务杀手杀死应用程序与 Android 操作系统杀死应用程序之间的区别

发布于 2024-09-25 23:05:13 字数 250 浏览 0 评论 0原文

使用任务杀手应用程序终止应用程序时发生的情况与 Android 操作系统因资源稀缺而终止应用程序时发生的情况有什么区别吗?

Android SDK 表示,当操作系统因资源稀缺而终止应用程序时,不会调用 Application.onTerminate() 方法。因此,听起来操作系统并没有完全关闭应用程序,而且它所做的正是备受争议的任务杀手所做的事情。

如果他们做同样的事情,那么任务杀手不会比操作系统本身造成更多的伤害,对吧?

Is there any difference between what happens when you use a Task Killer App to kill an app vs. what happens when the Android OS kills an app due to scarce resources?

The Android SDK says that the Application.onTerminate() method isn't called when the OS kills an app due to scarce resources. So it sounds like the OS doesn't cleanly close apps and that it does exactly what the much-debated task killers do.

If they do the same thing, then task killers don't do any more harm than the OS itself, right?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

千寻… 2024-10-02 23:05:13

从 Froyo 来看,没有区别。 :) 任务杀手所能做的就是在后台杀死一个进程 -9 ,这与操作系统在需要内存时所做的事情相同。是的,这不是一个干净有序的退出,而是立即终止进程。事实上,在常规 Android 环境中,Application.onTerminate() 永远不会被终止;进程只能通过杀死而消失。

在 Froyo 之前,任务杀手可以访问不同的 API(“强制停止”),这使他们能够更残酷地停止所有应用程序。这包括停止任何已启动的服务、删除任何已注册的警报、删除通知等。

As of Froyo there is no difference. :) All a task killer can do is kill -9 a process when it is in the background, which is the same thing the OS does when it wants its memory. And yes, this is not a clean and orderly exit, it is a kill-the-process-dead-right-now. In fact on regular Android environments, Application.onTerminate() will never be killed; processes only go away by killing.

Prior to Froyo task killers had access to a different API -- "force stop" -- that allowed them to much more brutally stop all apps. This includes stopping any started services, removing any alarms that are registered, removing notifications, etc.

绻影浮沉 2024-10-02 23:05:13

使用任务杀手应用程序终止应用程序与 Android 操作系统因资源稀缺而终止应用程序时发生的情况有什么区别吗?

任务杀手将应用程序从轨道上摧毁。它终止进程,删除所有警报,删除所有注册的PendingIntents(例如,用于位置更新)等。

在Android需要终止进程以释放RAM的罕见情况下,它只是终止过程。

如果他们做同样的事情,那么任务杀手不会比操作系统本身造成更多的伤害,对吗?

不,任务杀手对应用程序造成的伤害更大。

Is there any difference between what happens when you use a Task Killer App to kill an app vs. what happens when the Android OS kills an app due to scarce resources?

A task killer nukes the app from orbit. It terminates the process, removes all alarms, removes all registered PendingIntents (e.g., for location updates), etc.

On the infrequent occasion where Android needs to terminate a process to free up RAM, it just terminates the process.

If they do the same thing, then task killers don't do any more harm than the OS itself, right?

No, task killers do a fair bit more harm to the app.

笑忘罢 2024-10-02 23:05:13

AFAIK 根据经验,当 Android 杀死一个应用程序时,你不能指望它被彻底杀死(不调用 destroy 方法)。
至于任务杀手……好吧,我想这取决于特定任务杀手的实现方式。

Android 在管理资源方面做得很好,但是当你明确想要杀死某些东西时,任务杀手就会派上用场。为了回答你的问题,我认为任务杀手不会比 Android 杀死应用程序造成更大的危害。

AFAIK by experience, when Android kills an application you can't count on it being killed cleanly (no calls to destroy methods).
As for a task killer... well, I guess it depends on how a specific task killer is implemented.

Android does a great job managing resources on it's own, but a task killer can come in handy when you explicitly want to kill something. And to answer your question, I don't think a task killer does any more harm than when Android kills an application.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文