3

I have developed a simple Android application containing a widget showing the current location, the full code is published on GitHub. I implemented the application according to the official documentation from Google, but I encountered a strange problem - the onUpdate() function within the AppWidgetProvider stops being called periodically after the application is updated. The call occurs only once, immediately after the update, after which the function is never called again, which logically causes the widget to freeze. Until the application is updated, everything works fine and onUpdate() is called as often as specified by the updatePeriodMillis parameter.

I have tested the behaviour on different system versions, emulators and real devices and the same problem has always occurred. I have other applications containing the widget where the same problem is present too. I have no idea what the issue is, could someone please show me what I have missed?

  • I have similar problem. Did you find any solution? – AndroideuszPL Apr 29 '22 at 09:29
  • 1
    @AndroideuszPL Unfortunately I haven't figured out a way to fix `onUpdate()` callbacks, but scheduling updates manually using `AlarmManager` works more reliably. – Ondřej John May 01 '22 at 15:46
  • @I Ondřej John have experienced malfunction of the widget when previous instance of widget is not removed while the app is updated. when the app is updated, once you try removing the previous version widget instance and adding when the app is installed? If it works, we could do it programatically - when update is being installed, remove previous widget. – Vikas Pandey Oct 19 '22 at 15:59

0 Answers0