Can an Android app survive an application object?

So the question is pretty clear. Is it possible to destroy a custom Application object (the one that I declare in AndroidManifest.xml ) of a previously launched Service , provided that the Service not running in another process?

My intuition says that this is impossible, since we can access the Application object in the Service by calling getApplication() , plus I have not seen anything like this in the documentation, but Android is full of unexpected funny behaviors.

+7
android android-lifecycle android-service
source share
2 answers

Can a custom application object (the one that I declare in AndroidManifest.xml) be destroyed before the service is started, provided that the Service is not running in another process?

Each process receives its own Application object, and this object lives as long as the process runs. Therefore, any component (for example, a Service ) cannot survive Application from its own process.

+4
source share

When the application process is killed, all services in this process will also be killed. Thus, no, the service cannot survive the application object - see the "Process Life Cycle" in the service documents .

+3
source share

All Articles