https://kotlinlang.org logo
#glance
Title
# glance
b

brandonmcansh

02/10/2023, 10:41 PM
is it possible to have multiple instances of the same Glance widget? I'm not seeing any documentation around state definition and worker communication/interaction when dealing with more than one instance
w

Willie Koomson

02/16/2023, 1:29 AM
Yes, having mutiple instances of the same Glance widget should work fine. They will have unique app widget IDs and separate workers. GlanceStateDefinition should also continue to work with multiple widgets. The
fileKey
param for
getDataStore
is unique per-widget, so there will be separate DataStore for each widget as before
b

brandonmcansh

03/11/2023, 5:18 PM
My usecase is separate data showing in each widget based on a selected entity during configuration (e.g select organization, show data for that org)
m

Marcel Pinto

03/14/2023, 9:30 AM
Check the source code of PreferenceGlanceStateDefinition. It does what Willie is saying. That being said in the upcoming changes with recomposition support the state definition won’t be needed anymore. You can use the Glance ID to setup different configurations
27 Views