Updating widget on day change
What's the best way to call onUpdate on a widget once a day, after the date changes? It's no开发者_Go百科t high priority so it can wait until the phone wakes.
Just set an alarm with an Intent
that your AppWidgetProvider
receives using the AlarmManager
.
If you want the alarm to be fired only if the device is awake you should use ELAPSED_REALTIME
or RTC
as the alarm type. Make sure your xml file has updatePeriodMillis
set to 0.
精彩评论