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
Run a new configuration
When creating a new run configuration, it's important to ensure that the widget is recreated without launching a new activity. Follow these steps to do so:
In Android Studio, select Run > Edit Configurations.
In the Run/Debug Configurations dialog, select Always install with package manager....
Under Launch Options, in the Launch menu, select Nothing.
This will ensure that the widget is recreated but no activity is launched.
But when I follow these steps, after adding WeatherGlanceWidget, every time I relaunch the app from Android Studio, the widget displays the @layout/glance_default_loading_layout and WeatherGlanceWidget.provideGlance() is never called.
If I resize the widget, then provideGlance() is finally called, but it displays only the WeatherInfo.Loading state, never WeatherInfo.Available/WeatherInfo.Unavailable.
Screen_recording_20260317_134200.mp4
Relevant logcat output
[Run 'app' clicked]
---------------------------- PROCESS ENDED (25711) for package com.example.platform ----------------------------
---------------------------- PROCESS STARTED (26122) for package com.example.platform ----------------------------
(this time initial layout was replaced with glance composable loading state)
[Run 'app' clicked]
---------------------------- PROCESS ENDED (26122) for package com.example.platform ----------------------------
---------------------------- PROCESS STARTED (26595) for package com.example.platform ----------------------------
---------------------------- PROCESS ENDED (26595) for package com.example.platform ----------------------------
(this time initial layout is kept forever)
Is there an existing issue for this?
In which area is the issue?
User Interface
In a specific sample?
WeatherGlanceWidget.kt
What happened?
https://github.com/android/platform-samples/blob/main/samples/user-interface/appwidgets/README.md says:
But when I follow these steps, after adding
WeatherGlanceWidget, every time I relaunch the app from Android Studio, the widget displays the@layout/glance_default_loading_layoutandWeatherGlanceWidget.provideGlance()is never called.If I resize the widget, then
provideGlance()is finally called, but it displays only theWeatherInfo.Loadingstate, neverWeatherInfo.Available/WeatherInfo.Unavailable.Screen_recording_20260317_134200.mp4
Relevant logcat output
Code of Conduct