-
-
Notifications
You must be signed in to change notification settings - Fork 268
Description
Problem to solve
Currently, Android widget previews are often static, using an image or a simple layout. This means the preview shown in the widget picker can be significantly different from how the widget actually looks when placed on the home screen.
The Android platform has introduced a "Generated Previews" feature, which allows apps to provide a dynamic RemoteViews object to serve as a more accurate, rich preview. This allows developers to show previews that better reflect the widget's final appearance and can even include personalized data.
Proposal
I propose adding functionality to the home_widget package to support the Generated Previews API on Android.
This would likely involve:
- Exposing a new method in the Dart API that allows developers to provide the necessary data for a preview.
- On the native Android side, this method would construct a RemoteViews object.
- The native code would then call the AppWidgetManager.setWidgetPreview method with the generated RemoteViews to update the widget's preview.
Since Jetpack Glance now supports generated previews, the implementation could consider using the GlanceAppWidgetManager.setWidgetPreviews API as a modern approach to providing this feature.
More information
Instructions: https://developer.android.com/develop/ui/compose/glance/generated-previews
Which Platform would be improved?
No response
Other
- Are you interested in working on a PR for this?