When should a Service be stopped
<p>My android application starts a service in the onCreate() callback of a class that extends Application. The service performs some background tasks that are relevant to the user only while the application is running. For that reason I would like to close the service when the application's last activity is closed. I've tried to perform closing the service in the callback  onTerminate() , but it never gets called .  So what would be the best place where a service should be closed ?</p>

<p>Thanks !</p>
