[英]Updating widget on day change
What's the best way to call onUpdate on a widget once a day, after the date changes? 在日期更改后,每天一次在窗口小部件上调用onUpdate的最佳方法是什么? It's not high priority so it can wait until the phone wakes.
这不是高优先级,所以它可以等到手机唤醒。
Just set an alarm with an Intent
that your AppWidgetProvider
receives using the AlarmManager
. 只需使用
AlarmManager
通过AppWidgetProvider
接收的Intent
设置警报。
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. 如果您希望仅在设备处于唤醒状态时触发警报,则应使用
ELAPSED_REALTIME
或RTC
作为警报类型。 Make sure your xml file has updatePeriodMillis
set to 0. 确保您的xml文件已将
updatePeriodMillis
设置为0。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.