Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Bug]: WeatherGlanceWidget not reloading after relaunch

Aperta
#402 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
64/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
kotlin
Ambito
mobile

Direzione di ricerca

Inizia da samples/user-interface/appwidgets/README.md e WeatherGlanceWidget.kt, quindi riproduci la configurazione di Android Studio descritta nell’issue osservando la sequenza di logcat fornita. Traccia quando viene chiamato provideGlance() e come il widget supera il proprio stato loading; il lavoro è completato quando un nuovo avvio ricrea il widget e questo raggiunge lo stato previsto Available o Unavailable.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
Is there an existing issue for this?
  • I have searched the existing issues
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:

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.

https://github.com/user-attachments/assets/9b5cba4c-954d-4f59-9981-767ab29ebb38

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)
Code of Conduct
  • I agree to follow this project's Code of Conduct
Lingua principale
Kotlin
Stelle
1.7k
Fork
545
Merge medio
10g 10h
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di android/platform-samples

Tutte le issue di android/platform-samples

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.