You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't get a unique datastore per widget with Glance beta01. In your samples, there is a mention to it, but could you clarify how to inject the key in the datastore name ?
/**
* Use the same file name regardless of the widget instance to share data between them
*
* ====>>>>>If you need different state/data for each instance, create a store using the provided fileKey<<<<<<=====
*/
private val Context.datastore by dataStore(DATA_STORE_FILENAME, WeatherInfoSerializer)
override suspend fun getDataStore(
context: Context,
fileKey: String
): DataStore<SingleWidgetInfo> {
return context.datastore // How to use fileKey while creating the datastore ?
}
Relevant logcat output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
With the new glance release the concept of glance state is no needed anymore you should use recomposition and/or standard storage patterns with data store, DB or others
Is there an existing issue for this?
In which area is the issue?
User Interface
In a specific sample?
appwidgets
What happened?
Hello there
I can't get a unique datastore per widget with Glance beta01. In your samples, there is a mention to it, but could you clarify how to inject the key in the datastore name ?
Question asked on SO (feel free to close this issue) : https://stackoverflow.com/questions/76563756/android-datastore-how-to-create-it-with-a-dynamic-filename/76564053
Thanks
From https://github.com/android/platform-samples/blob/main/samples/user-interface/appwidgets/src/main/java/com/example/platform/ui/appwidgets/glance/weather/WeatherInfoStateDefinition.kt :
Relevant logcat output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: