@adamwolf Thanks for that link. What are the two errors?
I tried whitelisting TagTime as shown in the illustration above, but according to that link:
the system provides a configurable whitelist of apps that are partially exempt from Doze and App Standby optimizations. An app that is whitelisted can use the network and hold partial wake locks during Doze and App Standby. However, other restrictions still apply to the whitelisted app, just as they do to other apps. For example, the whitelisted app’s jobs and syncs are deferred (on API level 23 and below), and its regular
AlarmManager alarms do not fire.
So it looks like even whitelisting TagTime does not fix the “about every minute” problem.
Looking at the code, the alarm is set using setExactAndAllowWhileIdle:
https://github.com/tagtime/TagTime/blob/master/src/and/tagTime/src/main/java/bsoule/tagtime/PingService.java line 301
But in Doze, “alarms set with
setAlarmClock() continue to fire normally — the system exits Doze shortly before those alarms fire.”
So can we just replace setExactAndAllowWhileIdle with setAlarmClock?
Adam, you wrote:
In terms of workarounds, you can use Firebase Cloud Messaging to wake the app, but that requires network. You can also add a foreground service, which has to have a persistent notification. (Users can hide it using the system settings, but the app can’t hide it.)
From reading your link, it looks like there are two separate issues: Doze and App Standby. It looks like the foreground service workaround addresses just App Standby, not Doze.
Another exception for App Standby is if:
The app is an active device admin app (for example, a device policy controller). Although they generally run in the background, device admin apps never enter App Standby because they must remain available to receive policy from a server at any time.
So it might be possible to just declare TagTime a “active device admin app” somehow. Failing that we can just add a persistent notification.
@dreev says he also sees this problem happening with the screen on, though. I have only seen it when the screen is off, using the most recent github.