I'm trying to make an app with some scheduled tasks and an accessibility service logging info behind it.
The problem I see right now is that my tasks, which I use WorkManager
to run the Workers
at the time of the event, sometimes they don't run at the exact time I scheduled them to. I understand that this happens when the phone is using resources so Android pushes my task back to when it's free to do it, but how would I do it so that it always runs at the time I tell it to?
I've looked into it and found AlarmManager
with the setExactAndAllowWhileIdle
property could be of use, but I read in the docs that there's a limit to how many times this can run. I've also looked into Quartz-Scheduler, but I have no idea whether this will work in these cases.
The accessibility service has stopped working when not using my app for a long time too, and I imagine is the same problem (though not completely sure).
Would disabling "Battery Optimisation" for my app help with all of this? Or what would be a good approach to it?