I want a service which can run in the background until I stop, even if the component that started it is destroyed and also allows binding to the activities. How it is possible ?
As per android bound services document - there are three ways of creating bound service
You just need to start it with
startService() somewhere. This will prevent it from being stopped automatically when there are no more bindings.
From the Service documentation, emphasis mine:
A service can be both started and have connections bound to it. In such a case, the system will keep the service running as long as either it is started or there are one or more connections to it with the Context.BIND_AUTO_CREATE flag.
As others have pointed out, it could still be killed by Android if resources are needed. You can "prioritize" your Service and make it less likely to be killed if you make it a foreground service.