I would like to make an app that run a Service every 10 minutes when the app is not running. I've used an AlarmManager and a BroadcastReceiver to achieve this but the BroadcastReceiver is triggering only when the app is running. It's been a month I'm trying to figure out what's the problem, tried to make my service a foreground service, etc. but nothing worked. I've read a lot of similar questions about this but most of them are outdated and doesn't apply to my case. So here I am. How to run a task every 10 (or whatever, doesn't matter) minutes, even if the app is not running? Is the Doze-mode the reason I can't achieve this?
Asked
Active
Viewed 107 times
0
-
1You might want to look into WorkManager: https://developer.android.com/topic/libraries/architecture/workmanager – Mohammed Aquib Azad Feb 01 '20 at 20:13
-
This seems very interesting, thanks! But can I use it even if my project doesn't support Android Jetpack? – Vincent Feb 01 '20 at 20:24
-
AndroidX jetpack is supported very well. You won't have any issues. – Mohammed Aquib Azad Feb 01 '20 at 20:37