Should Battery Optimization be disabled on the Android App?

I have Phonetrack for Nextcloud on Android, and I’m wondering if Battery Optimization should be turned on, because logging apps tend to drain battery more than others. Would keeping battery optimization on impede functionality too much?

Ok, so here’s the thing; when you’re building an application to perform some work on a periodic basis, you’re going to use alarms to trigger the wake-up in order to do processing. Battery optimization means that those wake-up alarms are going to be adjusted by the system so that they correspond to other wake-up’s. Now at the same time, the system isn’t going to necessarily say “ok we have a window every 5 minutes”. Its actually going to stretch them out the longer the phone isn’t used. So the first window will be in 5 minutes, the second window will be 8 minutes after that, then 15 minutes, etc. – those numbers aren’t the real numbers by the way, just an example of how the sleep time stretches longer and longer.

Now on the other hand, you might NEED it to do some logging every few minutes on a more predictable basis. If this is the case, then the stretching time won’t be a very good thing for you, and you’ll need to disable battery optimization.

If its ok for you to have your location logging happening at ever increasing intervals, then battery optimization is probably fine to keep on, but if you need a predictable short interval, then disable it.