Android Application.getInstance 永远存在吗?

Does Android Application.getInstance always exist?

例如:如果我启动了一些服务并在该服务上创建了一个单独的线程,并且该服务被系统和其他 Android 组件终止(services/activities,e.t.c。 ) 也被杀了。但是线程和应用程序的进程仍然存在。在这种情况下我可以访问 Application.getInstance 吗?以及何时销毁应用程序对象?

And the service is killed by system and other Android components (services/activities,e.t.c.) are killed too. But the thread and the app's process are still alive.

该组合不存在。

Android 终止进程以释放系统 RAM。而已。组件将 "killed" 与过程 "still alive" 的唯一原因是如果某些东西破坏了它们(例如,finish()stopService()stopSelf())。一般来说,系统不会自己做这个。

Can I access Application.getInstance in this case?

如果您的进程在附近,Application 实例也在附近。

And when the app object is destroyed?

从来没有。它在进程执行时消失。