![]() In our case, we want our service to run at a very specific frequency and never be stopped, so we’ll need something else. ![]() JobScheduler works well if you don’t mind about not having access to the network and you don’t care about not controlling the periodicity either. Check out the list of restrictions Doze Mode imposes. And even worst, if you ever want to access the network -say you need to send data to your server- you won’t be able to. JobScheduler will run jobs at Android’s discretion and, on top of that, once the phone enters in Doze Mode, the frequency of these jobs being run will constantly decrease. Essentially, they are killed once the app is in background for a while making them worthless for our purpose of running an always-running service.Īccording to Android recommendations, we should be using JobScheduler, which seems to work pretty well and will handle wakelocks for us, keeping the phone awake while the jobs are running. Hope it helps! The problemĭue to Android battery optimizations introduced in Android 8.0 (API level 26), background services have now some important limitations. This is just a guide for all of you who pursue the same goal. I’ve been struggling these days trying to find a way to run an endless service in Android.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |