
For two weeks my phone carried a notification that never went away. It said the price was live, and I had written the code that kept it there. I trusted it the way you trust a clock on a wall. Then a friend looked at my lock screen and asked why that number disagreed with the exchange.
It was not a bug in the update code. The value was correct when it was written. The problem was the gap between writes, and the fact that nothing on the screen admitted the gap existed.
The cost is counted per hour, not per refresh
A thirty-second interval sounds modest, and it reads like a small, careful number. Divide an hour by thirty seconds and you get one hundred and twenty wake-ups. That count holds for every hour the screen stays on.
Each of those wake-ups costs something, and none of it is free. The radio comes up and a connection is re-established. A request goes out, and the device waits for an answer before it can idle again. None of that shows up in the code you wrote. It shows up in the battery graph a day later.
I had been thinking in units of updates, because that is the number I typed into the code. The phone thinks in units of radio time. It keeps that bill in a currency I never see until the graph appears.
The root problem is not the polling tool
The usual advice is to blame the mechanism. People say foreground services are heavy, or that polling is obsolete, or that you should switch to push. I tried that argument on myself for a while, and it did not survive contact with the actual problem.
The root problem was a permanent cost attached to a number that mattered a few times a day. The notification itself was never the part I got wrong. The mistake was the promise I attached to it, which is that this value is worth watching continuously.
A permanent notification is a claim about the present. It tells the person holding the phone that something is happening right now and that they should be able to see it. If that claim is only true twice a day, the notification is not a feature. It is a small lie that stays on screen.
Two numbers I could measure, and one I could not
I do not have lab equipment, so these are estimates from my own phone over ordinary days. On Wi-Fi, the service cost roughly one to two percent per hour. On 5G with Tailscale running, it cost closer to three to five percent per hour.
That second range is the one that ended the experiment. A phone that loses five percent an hour while sitting untouched is a phone you notice by mid-afternoon. I did not need a study to know that I would not keep such an app installed on someone else's device.
What I could not measure was whether anyone actually read the value at that frequency. There is no data yet on how often the notification was looked at. For my own use the honest answer was rarely, and I had built the whole thing for myself first.
Android 15 put a clock on the design
There is a second reason the design was fragile, and it is not about my code at all. Android 15 limits the dataSync foreground service type to six hours per day when an app targets SDK 35 or higher.
My build targets SDK 34, so the limit did not apply yet. That is not a stable position, and it behaves like a countdown. The first time I raise the target SDK, an all-day service of that type stops being allowed. Then the feature has to be rebuilt around a schedule I do not control.
I would rather remove a feature while I still choose the timing. Waiting for a platform update to remove it for me means the decision gets made in a rush, after something breaks.
What removing it actually bought
I deleted the widget and the service together, because they existed for the same reason. The APK dropped from 8.05 MB to 2.15 MB. That number surprised me more than the battery figures did.
I expected a small service to weigh almost nothing. It turns out the libraries, the layout resources, and the update path around it occupied most of what I had shipped. The download got smaller and the permission list got shorter. The app also has one less thing that can fail silently at three in the morning.
The trade is real, though, and it is worth naming. Without the service there is no live number. The app opens, fetches, shows what it has, and closes. That is a worse experience for a value that genuinely changes every minute.
Where this advice stops
These numbers come from one phone, on my own network, over a handful of ordinary days. They are estimates, not measurements from a controlled test, and I have not repeated them on another device. Treat the percentages as a scale, not a specification.
The removal also assumed something about the value being watched. If your data changes every thirty seconds and someone makes decisions from it, the battery cost may be entirely justified. A trading screen is not a weather widget, and I would not apply this lesson to both.
The one thing I would carry over is the honesty requirement. If the screen can be out of date, it should say so, and it should say how old the number is. A label reading "two minutes ago" costs almost nothing to render. It also prevents the exact confusion my friend noticed on my lock screen.
So the question I keep coming back to is this. For the last feature you removed, did you measure the cost first? Or did you remove it because you finally got tired of defending it? I have done both, and only one of them left me with a number I could explain.
Cover photo: OnionBulb, CC BY-SA 4.0, via Wikimedia Commons.
