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
Hi,
I am currently struggling a bit to implement a configurable Widget for Android.
First of all I use the Glance Implementation for the normal widget and assigned a Configuration Activity and XML View for the configuration screen.
After configuring the Widget I want to save the data in the SharedPreferences and access that in my Flutter Application where I use the value inside my app to call other functions.
I would expect a method inside HomeWidgetPlugin with a saveWidgetData method to save the data with the corresponding Widget Id. I then can access the data with the right key from my Flutter Application.
The same goes for iOS which I did not tried out yet.
I would create a PR if there is a need for such a feature or to add more information to the README.
The text was updated successfully, but these errors were encountered:
I managed now to retrieve the widget information by saving the configuration with the appWidgetId and the getData()method. I then can iterate in the Flutter part over the widgetIds and can retrieve the configuration. Is this how you would do it?
I am still struggling with some parts of implementing the configuration. I want to save the configuration information about the widget, let's say a weather location, into the SharedPreferences. While on Android you have methods like onCreate to save the location and onDelete to delete it again. I don't have similar hooks in iOS. I can only retrieve the information from the IntentTimelineProvider when the widget gets initialized with getSnapshot as far as I can see. The problem with that is that is I don't know when the widget is being deleted and therefore I don't know how to delete the location from the SharedPreferences again. Furthermore there is no WidgetId which I could use to uniquely identify a widget from the flutter part.
At this point I am not sure how to implement all this :/
Hi,
I am currently struggling a bit to implement a configurable Widget for Android.
First of all I use the Glance Implementation for the normal widget and assigned a Configuration Activity and XML View for the configuration screen.
After configuring the Widget I want to save the data in the SharedPreferences and access that in my Flutter Application where I use the value inside my app to call other functions.
I would expect a method inside
HomeWidgetPlugin
with asaveWidgetData
method to save the data with the corresponding Widget Id. I then can access the data with the right key from my Flutter Application.The same goes for iOS which I did not tried out yet.
I would create a PR if there is a need for such a feature or to add more information to the README.
The text was updated successfully, but these errors were encountered: