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 enable background activity on Android?
Turn on background data
Read moreHow do I enable app services in Android 11?
How to adjust permissions on Android 11. To locate the Permission Manager, open the Settings app and then tap Privacy . In the resulting window, tap Permission Manager. You should now see a listing of all the available services on your device (Figure A).
Read more