简体   繁体   English

Android:每X小时更新一次来自服务器的天气数据

[英]Android: Update some weather Data from server every X hours

What is the best and most efficient way in android to schedule an update for some weather data from the server every X hours? 什么是Android中每X小时为服务器安排一些天气数据更新的最佳和最有效方式?

Thanks Sam 谢谢山姆

If you are asking about scheduling system, a good way is using AlarmManager , which can wake up your activity even if it is not running. 如果您询问调度系统的问题,那么最好使用AlarmManager ,即使它没有运行,它也可以唤醒您的活动。

Here is some info: http://developer.android.com/reference/android/app/AlarmManager.html 这是一些信息: http : //developer.android.com/reference/android/app/AlarmManager.html

And here a nice example with Notification : http://android.arnodenhond.com/tutorials/alarm-notification 这是一个带有Notification的漂亮示例: http : //android.arnodenhond.com/tutorials/alarm-notification

AlarmManager注册您的应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM