I had a talk about Glance Widget today at droidcon Lisbon. Here is the demo application: https://github.com/PiotrPrus/WeatherGlanceWidget
The widget present temperature and wind from choosen location, updating manually or every 15 minues using WorkManager.
👍 4
y
yschimke
04/22/2022, 4:59 PM
That's a really great example of cleanly using the widget state with work manager updating. I'm going to adopt a lot of this. Thanks for the great example.
p
Piotr Prus
04/22/2022, 9:26 PM
Thanks for the kind words. Google didn't create any official guidelines about updating widgets yet, but for me the work manager makes the most sense.
m
Marcel Pinto
05/18/2022, 12:30 AM
(Back from my leave and catching up with messages)
Great job on the widget. Indeed WM is the way to go, we are still working on a way to integrate it inside the framework.
btw, State could use protobuf or kotlin serialization to map the state, that maybe would simplify your state helper class (or not, protobuf are complex xD)
p
Piotr Prus
05/18/2022, 8:37 AM
Welcome back Marcel 🙂 . I was thinking about protobuf, but it may add some complexity. However the example with widget state using protobuf is a good idea for official examples 🙂
m
Marcel Pinto
05/18/2022, 8:44 AM
Thanks ☺️. Yes the setup is a bit complex. There is a good guide of the data store with protobuf that is applicable to glance too. We might include in the official sample. Kotlin serialization might be easier though