关于桌面widget的动态刷新有这样一个配置,
在res/xml下<appwiget-provider>下有一个属性
android:updatePeriodMillis="86400000"
官方的注释是:
The updatePeriodMillis attribute defines how often the App Widget framework should request an update from the AppWidgetProvider by calling the onUpdate() callback method. The actual update is not guaranteed to occur exactly on time with this value and we suggest updating as infrequently as possible—perhaps no more than once an hour to conserve the battery. You might also allow the user to adjust the frequency in a configuration—some people might want a stock ticker to update every 15 minutes, or maybe only four times a day.
中文翻译:
updatePeriodMillis这个属性规定了AppWiget框架应该多久发送一次请求通过调用AppwidgetProvider的onUpdate()方法来更新,实际的更新并不能保证根据这个值准时的更新,我们建议尽可能频率少的进行更新操作,最好不要超过1个小时更新一次,为了保存电池的电量。你页可以给出配置允许用户来调整更新的频率,就像一些人希望股票行情追踪器每15分钟更新一次,或者仅仅一天更新4次
Note: If the device is asleep when it is time for an update (as defined by updatePeriodMillis), then the device will wake up in order to perform the update. If you don't update more than once per hour, this probably won't cause significant problems for the battery life. If, however, you need to update more frequently and/or you do not need to update while the device is asleep, then you can instead perform updates b