I implemented a Glance Widget using
Glance 1.0.0-alpha05
GlanceAppWidgetHost 0.2.2
Using the following provider spec. Notice the updatePeriodMillis = 0
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:description="@string/loyalty_card_title"
android:minWidth="110dp"
android:minHeight="50dp"
android:resizeMode="horizontal|vertical"
android:targetCellWidth="2"
android:targetCellHeight="2"
android:widgetCategory="home_screen|keyguard"
android:updatePeriodMillis="0"
android:initialLayout="@layout/loyalty_card_widget_initial"
android:previewImage="@drawable/splash_logo"
tools:targetApi="s" /> <!-- targetCellWidth and -height will be ignored by api < s, which is fine -->
Now, every time I close(and perhaps open, too) I see the widget update, which manifests in the initialLayout being shown very briefly, giving a glitch appearance. Nothing regarding the widget data changed. How to prevent this?
Issue looks closely related to In Android, Glance widgets are "flickering" during every update (even if there is no content change) and associated bug report https://issuetracker.google.com/issues/241076154
However, I am unsure if it is reelevant since I do not use WorkManager anywhere in my project.