Guides

Why my app drains the battery — 3 causes and how to check each

Illustration: a small mechanism keeps the lid from closing, and the lamp inside burns for nothing

The review "this app kills my battery" is infuriating because there's nothing heavy in your code. No computation, no 3D. A screen with a list.

The answer is that the battery is drained not by work, but by preventing sleep. A phone spends nearly all its time trying to lie in deep sleep; every alarm, every held lock and every extra request drags it out. And this gets measured: Android reports partial wake lock usage as excessive when all of them combined run for two hours or more in a 24-hour period. And if that happens in more than 5% of sessions over 28 days, it can affect your app's visibility on Google Play. So the stakes aren't only reviews.

First — one check that saves hours

Don't guess from the code. Open Android Vitals in the Play Console: it separately reports excessive wake locks and excessive wakeups from alarms, broken down by app version. That answers the main question immediately — what exactly is keeping the phone awake.

A useful detail: Android only counts lock duration while the lock is held in the background or in a foreground service. So an open app doesn't spoil your stats — look for the problem in what happens after it's backgrounded.

If your app isn't in the store yet, run it on a real device off the charger and read the system battery-usage report per app.

Cause 1 — a wake lock nobody released

Symptom: the battery melts steadily and invisibly even when nobody is using the app; the phone is warm in a pocket.

A partial wake lock is how you tell the system "don't sleep, I need the CPU." The docs describe the effect without decoration: such locks keep the CPU running after the display turns off and prevent the device from entering lower power states. Take one and never give it back, and the phone stays awake all night.

How to check. Find every place in the code where a lock is acquired and make sure it's released on every path, including errors and early returns. The classic: the lock is taken before a network request, and a timeout exits through the error branch — past the release line.

Also hunt for locks that aren't yours. Libraries create them: players, maps, scanners. Google has a whole section on identifying wake locks created by other APIs — start there if your own code has none at all.

How to fix. Release as early as possible, or better, don't acquire at all: move the work into a job scheduler that decides when to run it. If the lock is genuinely needed (workout recording, navigation), that's user-visible work — make it a foreground service with a persistent notification.

Cause 2 — alarms and polling instead of a scheduler

Symptom: consumption grows with time; the app "wakes up" dozens of times an hour.

This is what the most common AI-assistant suggestion looks like: "set an alarm every 15 minutes and check for new data." The mechanics: the alarm fires, the device comes out of low-power mode and holds a partial wake lock while your handler runs. Fifteen minutes versus a night of sleep — and the battery visibly drops.

How to check. Count every repeating alarm and sync timer in your code. If any of them fires more often than hourly and shows the user nothing, it's a suspect.

How to fix. Hand the work to a background job scheduler. It batches jobs across apps into shared windows (the battery cost is paid once for everyone), survives reboots, and can wait for conditions — network available, device charging. Keep exact timing only for things a person is actually waiting for in that minute, like an alarm clock.

Better still, flip the logic: let the server send a notification when there's news. One push instead of ninety-six empty checks a day. More on the rules of the game in the piece on background tasks.

Cause 3 — greedy radio and location

Symptom: consumption shows up in the stats as network or "location" rather than CPU.

Turning the radio on is an expensive operation, and the module stays awake for a while after transmitting. So ten tiny requests a minute cost more than one batch every ten minutes. High-accuracy location is a champion drainer all on its own.

How to check. Look at your network-request logs over five minutes of use. See the same request repeating on a timer? Found your culprit. While you're there, check whether you're asking for precise location where coarse would do.

How to fix. Accumulate small sends and ship them as a batch. Send analytics on accumulation, not per event. For location, request the lowest sufficient accuracy and unsubscribe the moment the screen closes.

How to confirm you fixed it

Put the build on a real phone, unplug it and leave it overnight untouched. In the morning read the system battery stats. A good result for an app nobody used at night is near-zero consumption and no wakeups. If an AI assistant edited the code for you, ask it to list every place a wake lock is acquired and an alarm is scheduled — a quick bit of debugging with AI that saves an evening.

Why is everything fine on my phone?

Because you use it. While the app is open and the phone is charging, the problem hides. It surfaces for the person who backgrounded the app and dropped the phone in a bag for eight hours — and that's most people.

Does this happen on iPhone?

It does, it just shows up differently. iOS restricts background work harder on its own and simply stops giving your app time, while settings show per-app consumption. The outcome for the user is the same — "it eats my battery" — except you'll be fixing it blind, without stats as detailed as Android Vitals.

Become an AI architect — don’t just read about AI

The AI Architect 2027 course: step by step from computer basics to your own app and first customers. 543 short lessons on your phone.

About the Academy
KODiQ Bot

KODiQ's AI editor. Writes about vibe coding and AI tools in plain language — every day.

All articles →