This certainly is not “never since Android 9 update”, I think I start observing this fairly recently. Though Google is known for on-the-fly tweaking various settings. I’d prefer things to work without explicit exclusions of course. Maybe during phone “on” state at least.
Strange thing is that when I was observing this yesterday, manual refresh (clicking on the respective widget area) did not work either.
This probably is connected with battery optimizations. At least after including into exclusion list, the widget can be refreshed manually.
I did a few experiments: When not excluded from battery optimization, “refresh” does not work after getting from standby. Weird thing is that opening Edit Widget (by pressing three dots or something in right-top area) does work, dialog opens. After this, back on home screen, “Refresh” area starts working again (icon briefly appears in top status, time of update changes). Till going to standby or something. This is strange: “manual update” should work if “Edit widget” works…
I sent the corresponding log.
A few other widgets I have do manage to update without any exclusions (though some not too consistently, but I’m ok since they are easy to manually refresh).
Running Pixel 2 XL Android Pie.
The only consistent issue I have seen with the widgets is after an application update. I’ll have to ‘Save’ the configuration of the Widget and then they will auto update.
Indeed: once I “Save” config in the app, widget start auto-updating itself.
Though “Forced update” (pressing on the respective widget area) still normally does not work even in this case: it works only after I enter widget configuration and then exit, even doing nothing at all there. Works until the phone goes to standby, then this becomes inactive again. But the widget still auto-updates (after magic enabling by “Save” above).
BTW, I do have a plan. Currently, the widget is updated using a set time in a Android system config file. I might try using a repeating alarm instead. In this case, I tell the Android system to set an alarm to trigger an action, in this case, update the widget.
I think it might work. I need testers. Let me know if you’d like to test the apk.
I have to say though that since I did “Save” of the config a ~week back (see this thread earlier) – the widget has been updating itself quite fine. (not taking it off battery optimizations or whatever).
I plan to add the new alarm based widget updates to a separate alpha build so it doesn’t go out to everyone as it might cause other issues. When we’re confident it works then we can roll it out to others.
According to debug logs I’ve seen, the Android system is not calling a widget update as they are supposed to. This is an Android OS problem. They are not following their own standards.
This is the Android documentation for widget:
The second grey panel shows the config file with the “android:updatePeriodMillis” parameter. This is exactly what Flowx has used from day one of the Flowx widget and now, after 5 years!, it suddenly sporadically works.
The Android OS is simply not calling an update. I’m reluctant to spend time trying to work around this problem for a few reasons:
It’ll take a bit of time.
it’ll may introduce issues on other phones.
this is an Android OS issue, it should be fixed at the source.
My gut-feeling is that trying to fix this will a rabbit-hole of a time sink. My preference is that we wait a bit longer to see how other apps respond and how Android OS developers respond.
the widget stops updating because the Android stops calling widget updates.
predominantly Pixel, Pixel 2 and Pixel 3 phones, plus a modern Huawei and possibly a modern Samsung phone.
the widget update approach has been the same since 2013 and follows the Android documented approach.
there has been no major change to the widget code in months, possibly over a year. No minor changes for months.
This clearly points at the only major change in the last 6 months - Android 9 and is probably something to do is aggressive battery savings.
Since you can edit the widget, then save and the widget starts updating, I suspect this is a bug on the Android side.
Why do widgets for other apps update? I know of two other methods for updating widgets, scheduled alarms and using Firebase to trigger an update. Maybe they use this update method. Or maybe they haven’t gone through a app version update.
Why don’t I use one of these methods? I could and it’s relatively easy to test the scheduled alarm approach. This might work fine when released to beta tester (~1200 phones) but when released to 70k phones, more bugs can appear. Then I’ll be back to square one, debugging widgets that aren’t updating. This might not happen but it could and that would suck.
To be clear, this is not a Flowx bug, this is a Android 9 bug. Android 9 is not calling widget updates.
So the question arises, do I spend hours working around this Android 9 bug, or do I wait for Android to fix the bug and spend the hours implementing radar, world view or some other cool feature?
I’ve done more searching. I’ve found a new permission requirement in Android 9 for Foreground Services. This may improve updating the widget when you manually update it by clicking on it. I don’t think it’ll affect automatic updates.
I’ll also update the libraries and target Android 9 in the next release. We can see if this helps.
Regarding the change in auto-update behavior before and after the most recent update (as I indicated above, doing vs. not doing auto-updates after doing Save once) – do you see any recent change that could’ve led to that, or this is just because the updated happened and something somewhere in the system was reset? Might give some clues…