Starting again to play with Glance with alpha5 but...
# glance
t
Starting again to play with Glance with alpha5 but I'm facing a strange issue and have no idea where to start looking. It seems there's a race internally And when calling
Copy code
AGlanceWidget().updateAll(it)
BGlanceWidget().updateAll(it)
Then something the wrong widget content is rendered (Like A is rendered in B widget)
Those are 2 different widgets with 2 different configs and receivers and everything, not 2 instance of the same widget
k
Do they use a different
GlanceStateDefinition
?
t
I don't use them, but I found the issue I was calling updateAll from the wrong one in one case and sometimes this triggered this. Is there a way to trigger the proper widget update from just the glanceId?
m
Do you mean only knowing the GlanceID without knowing from which provider/widget comes from?
t
Yes I have the GlanceID and want to refresh that widget without any more knowledge of the actual widget. Like a global loading image to cache then the cache refresh the widget when it's loaded.
Currently I pass a callback that does the Widget().update() but this is strange to have to do that.
m
not sure that’s possible. You would need to know at least the existing providers and then loop through their ids https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidgetManager#getGlanceIds(java.lang.Class)
t
In normal widget code this is possible it would be a nice addition.