Skip to content
Advertisement

Android service not working when app is closed

I’m having trouble with an android service that I’m doing. The service is about to get the location of the user every 5 minutes. All seems to go well except when i kill the app, the service won’t do nothing. In the code you will ses its checking every 60 seconds I think, but this will change to 5 minutes.

Minimum Target Version: API 23

Target Version: API 29

Android Manifest:

JavaScript

Code that executes the service:

JavaScript

Service:

JavaScript

}

Advertisement

Answer

AlarmManager is deprecated if used for that purpose. Have a look at WorkManager.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement