Search code examples
androidandroid-appwidgetauto-updateappwidgetprovidersystem-clock

Android app widget not updating after changing system clock


I have an Android widget scheduled to update every hour

android:updatePeriodMillis="3600000"

However even when I change the system clock (forward one hour or more) the widget update method is not being called, no visual changes or logs happen.

I even wait a couple of minutes thinking that the OS may wait till the next minute because it doesn't need precision, but still nothing triggers.

Changing the system time won't trigger the basic widget updates?


Solution

  • The widget uses another internal clock to update itself, You'll need to wait 30 minutes in order to see the change and this cannot be hasted by changing the device's date.

    If less time is required, then AlarmManager is the option.

    IMPORTANT: If widget frequency is 30 minutes, ALL USERS will update the widget exactly at 00:00 and 00:30 of each hour. So if the widget consults a service the server will get peaks of requests every half an hour.