Reputation: 110510
From here,
It said Service is not a separate process and it is not a thread. But how can it "A facility for the application to tell the system about something it wants to be doing in the background" ?
How can something being done in background without being a process or a thread?
Upvotes: 0
Views: 414
Reputation: 13801
A service is more or less a potentially-long lived Android object. In other words, Android will instantiate a service object for you and keep it alive for you until you tell Android you are done with it.
It is common for services to start a background thread to perform some task. Once they complete their task, they tell Android that the service can be stopped. Once your service is stopped, Android will call onDestroy on it. Now that Android knows your service is done, if the rest of your application isn't running, Android may decide to destroy the process your application was using to reclaim memory. It wasn't doing this before since your service was running.
Think of it this way (note, some things are left out as to not overwhelm you):
Upvotes: 1
Reputation: 81349
How can something being done in background without being a process or a thread?
Simple, is not a process but is part of some process. This means there could very well be a single process that handles all services in the system, similar to how widgets are handled at the home activity.
Upvotes: 0