I want the service to start in the background when one of several actions in my application is visible.
I am currently bound to it in a subclass of Application , for example:
public class App extends Application { @Override public void onCreate() { super.onCreate(); bindService(new Intent(this, MyService.class), mServiceConnection, BIND_AUTO_CREATE); } }
However, there is no corresponding onDestroy method where you can disable the service. When, at the end of the last action, the service continues to work indefinitely.
- Is this normal as it is? Should I just let the OS shut down the service with low memory?
- Alternatively, is there a way to do this based on activity?
user668660
source share