开发者

Updating widget on day change

开发者 https://www.devze.com 2023-02-22 03:42 出处:网络
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 yo

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消