Android Doze mode vs. notifications
Still trying to understand why my fancy Google Pixel doesn’t show me notifications in a timely fashion. I got some new insight into a possible cause from some Reddit comments: Android Doze mode.
Long story short, Doze is a power saving system w here the phone only wakes up every 15-28 minutes to process things in what they call “a maintenance window”. Normal notifications get delayed too, although there is an option for high priority notifications from apps. There’s no way to configure it with the usual Android settings. There are ADB hacks you can apply (and have to re-apply every reboot): see here or here for detailed discussions and solutions. The key thing is the command dumpsys deviceidle disable.
But Doze has been around a very long time, since Android 6. I only started noticing a problem around a year ago, maybe around Android 13 or 14. Did something change?
I’ve got no problem with low power modes! But they can’t interfere with basic use of the device. It’s particularly vexing for me since my phone spends most of its time sitting on a Pixel Stand at 100% battery, power saving is not my problem. (Which suggests one possible change: Pixels have gotten recent changes in battery charge optimization that means the phone may not realize it has a source of charging power when it’s near 100%.)
Another possible explanation for a change is that high priority messaging thing. It’s hard to imagine but maybe Gmail, Signal, and Messages aren’t getting high priority messages anymore and so don’t wake up? That’d be dumb. But maybe it’s a bug / bad system interaction?
Update: Gmail is definitely not getting reliable updates. Twice today I only got updates when I woke the phone up maually. I have no way of knowing what priority Gmail sends its notifications at but it’d sure be dumb if it weren’t high. Gmail has a zillion options for configuring its notification behavior. Most of them were turned on but “Notify for every message” was off. I’ve turned it on, now to wait a few days to see if it makes a difference. (No immediate improvement, just had more mail not show up as notifications. Even after I woke the phone, still took 30 seconds or more.)
Mostly I’m just tired and cranky about this bug. It’s affecting a huge number of Android users all over the world. It has to be obvious to any Google engineer who uses an Android phone regularly. Do they just think it’s OK? Can’t reproduce it? Don’t care?
This is the point where I’d be the hero who does a lot of testing and figures out the problem himself, finds a fix. But fuck that, I’ve got better things to do and don’t really know enough to tackle this one myself. It’s particularly frustrating because it’s hard to reliably reproduce the problem, mostly I notice when I haven’t seen an email I know I got about once a day. Anyway if I do get the interest to tinker again, things to try:
- the ADB hacks
- turn off Google’s battery saving charging, see if it works better on the charging stand.
Update: ntfy.sh
Got some interesting perspective reading ntfy.sh’s docs.
Instant delivery allows you to receive messages on your phone instantly, even when your phone is in doze mode, i.e. when the screen turns off, and you leave it on the desk for a while. This is achieved with a foreground service, which you’ll see as a permanent notification that looks like this: ....
Limitations without instant delivery: Without instant delivery, messages may arrive with a significant delay (sometimes many minutes, or even hours later). If you’ve ever picked up your phone and suddenly had 10 messages that were sent long before you know what I’m talking about.
The reason for this is Firebase Cloud Messaging (FCM). FCM is the only Google approved way to send push messages to Android devices, and it’s what pretty much all apps use to deliver push notifications. Firebase is overall pretty bad at delivering messages in time, but on Android, most apps are stuck with it.
The ntfy Android app uses Firebase only for the main host ntfy.sh, and only in the Google Play flavor of the app. It won’t use Firebase for any self-hosted servers, and not at all in the the F-Droid flavor.