I am trying to run a service in the background. What my app does is when user checks checkbox then service starts and when it is unchecked service is stopped. Which is worki
You can try to restart service on onDestroy event of service. Use some flags to find if service is closed by the User or its force closed.
Note that there is not guarantee that onDestroy will be called everytime.