0

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.

Nino van Hooff
  • 3,677
  • 1
  • 36
  • 52
  • By `GlanceAppWidgetHost`, do you [mean `GlanceAppWidget`](https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidget) or [perhaps `GlanceAppWidgetReceiver`](https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidgetReceiver)? I [cannot find anything named `GlanceAppWidgetHost`](https://cs.android.com/search?q=GlanceAppWidgetHost&sq=&ss=androidx). – CommonsWare Dec 06 '22 at 13:39
  • Sorry for not mentioning that; added. https://github.com/google/glance-experimental-tools/tree/main/appwidget-host I don't care much about this dependency, so I could remove it if related to the problem – Nino van Hooff Dec 06 '22 at 14:16

0 Answers0