Articles ·
Battery optimisation vs. a reliable background app
Android manufacturers may stop background apps to save power. How KlipTrack keeps tracking reliably with alarms, notifications, device-specific settings and alerts to the office.
A work-time tracking app is doing its job when nobody has to think about it. The phone stays in a pocket, tracking happens automatically, and the attendance sheet is there at the end of the day. The biggest obstacle is not a weak signal or a basement. It is the phone itself: every manufacturer has its own way of saving battery, and the simplest method is to stop apps running in the background.
The first warning: two and a half hours of silence
One evening, a phone went quiet for two and a half hours, and the report showed a departure that had never happened. The logs revealed the cause: Android’s power-saving mode, Doze, had frozen the app.
The first suggestion was to set the app to “unrestricted” battery use on the phone. The client’s response was spot on: that is not a solution, because colleagues are not going to dig through their settings. They were right. If a problem happens because someone has to remember to do something, the fix belongs in the system, not in an instruction.
A wake-up alarm during working hours
The solution was an alarm that Android delivers even in power-saving mode: during working hours, it wakes the app every fifteen minutes. It is the only mechanism that works through Doze without asking the user to change anything.
The first version had a catch. Every alarm restarted location tracking, which reset the app’s own half-hourly presence-check timer. With a restart every fifteen minutes, that check would never run. We caught it before release, when the client asked whether the change would drain the battery or use too much data. While answering, I reviewed the whole flow and found the issue. The alarm no longer resets the check timer.
The manufacturers’ own power controls
Standard Android settings are not enough. Several manufacturers run their own power management on top of Doze, with an allowlist that apps cannot read or request access to. We saw this live: a Samsung phone with the standard exemption set still dropped out and came back roughly every sixteen minutes throughout the day.
There is no perfect fix, only the best practical one: the app recognises the manufacturer and opens its own battery settings with one tap, alongside instructions for what to change. Guides are included for common brands in Hungary: Samsung, Xiaomi, Redmi, POCO, Huawei, Honor, OPPO, Realme, Vivo and OnePlus. These settings screens are undocumented and may change after a system update, so the app tries several routes in order. If none opens, it falls back to the standard settings. For an unknown manufacturer, it would rather give no advice than give the wrong advice.
The server checks too
During working hours, the phone checks in with the server every thirty seconds to get its settings. If it has not checked in for ten minutes, the server can tell that the app is not running and sends a high-priority notification to wake it. It does this in two situations:
- just before the working day starts, so a phone stopped overnight can resume tracking before anyone picks it up;
- at any time during the working day, so if power management stops a phone at 10 a.m., it can be brought back within minutes.
These notifications must be used sparingly. If a high-priority notification does nothing visible, Google may eventually downgrade the app’s notifications, and a regular one will no longer wake a sleeping phone. So if the phone responded to the last wake-up, it can be checked again in half an hour; if it did not—because it is off, was stopped manually or was frozen by the manufacturer—the next check waits two hours.
An alert for the office
The phone also reports its power settings to the server: whether it is exempt from battery optimisation, whether battery saver is on and whether GPS switches off on the lock screen. If a setting could interfere with tracking, the administrator gets an email. There is no need to wait until the end-of-week report to find out that a phone has been recording incorrectly for days.
The device log also shows whether a wake-up notification reached the phone and whether the app was already running when it arrived. That means the answer to “Why did it stop tracking?” comes from evidence, not guesswork.
What I learned
The phone is not our device. We cannot stop its manufacturer from shutting down the app. We can bring the app back quickly and report when we cannot.
This part is invisible in the interface, and nobody is going to praise it. But it is what determines whether the attendance sheet reflects reality. For an app used in the field, reliability is not an extra feature; it is the product.
In the next part, I explain why almost everything in KlipTrack can be switched off: Features, not tiers.