'Android TextClock seems to cause background battery drain on a full screen intent notification
I have an reminder type of app that generates a full-screen notification via setFullScreenIntent when the alarm triggers. It works well.
The full screen activity is backed by a native XML that simply displays some text data from the passed intent. On top of it, I have a TextClock widget in default settings: so it simply displays a text clock with hours and minutes. This is similar to Android's default lockscreen.
What I found is that, if the user does not dismiss this notification (say the phone is just left aside in idle state), the existence of this full-screen activity with TextClock will rack up background time and usage percentage under Android's battery stats.
Now the full-screen activity does have showWhenLocked and turnScreenOn set, so it'd wake up the screen briefly. However, the screen does go back off very shortly without user action, because it does NOT use keepScreenOn.
I'd imagine the TextClock, being a native widget, should be fairly optimized and not cause any battery drain, especially when the screen is off and phone is idle. It should only need to update itself when screen is back on again.
But instead the phone seems to treat this as being running in background the entire time if not dismissed.
Any idea if this is normal, and if there's any way to optimize it without sacrificing the utility?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
