you need to start your service using startService() method.
Read moreHow long can background service run Android?
2 Answers. Show activity on this post. Depends on the code, you can run the background service forever or close it as soon as the app has been exited. Apart from that, OS itself can close the background service if no action is performed by it for several minutes.
Read moreHow do I keep apps from running in the background permanently?
Android – “App Run in Background Option”
Read moreDoes service run in background Android?
Service is a component which runs in the background , without direct interaction with the user. As the service has no user interface it is not bound to the lifecycle of an activity. Services are used for repetitive and potential long running operations, checking for new data, data processing, indexing content, etc.
Read moreHow do I run a service in the background Android even when the app is closed?
Intent Service -The IntentService class provides a straightforward structure for running an operation on a single background thread. IntentService runs outside the application in a background process, so the process will run even if your application is closed.10 Oca 2018
Read moreHow do you keep a Countdowntimer running even if the app is closed?
To keep the timer running while the app is closed, you need to use a service . Listen to the broadcast of the service in the activity. See this SO answer to learn whether registering the receiver in onCreate, onStart, or onResume is right for you.
Read more