如何查询从Android电子有限区间web服务? [英] How to poll a webservice at finite interval from android?
问题描述
我正在开发一个Android应用程序,以显示notifications.How我可以查询在有限区间web服务(比如10分钟间隔)以确定是否有更新,并显示在Android的通知面板通知。
i am developing an android app to show notifications.How can i poll a webservice at finite interval (say 10 min interval) to check for any update and show as notification in android notification panel.
推荐答案
您的不需要的服务。我觉得自己像一个破纪录。在这种情况下,使用一个服务将在那里坐的95%的时间无所事事,但仍使用系统资源,更重要的是电池电量的消耗。
You do not need a service. I feel like a broken record. In this use case a service will sit there for 95% of the time doing nothing but still using system resources and more importantly drain the battery.
请参阅使用从AlarmManager报警类似的问题我的回答是:
Please see my answer on a similar question that uses an Alarm from the AlarmManager:
<一个href=\"http://stackoverflow.com/questions/8615543/running-task-periodicalyonce-a-day-once-a-week/8615600#8615600\">Running任务periodicaly(每天一次/每周一次)
编辑:
看从Android开发网站如何实现通知本教程:<一href=\"http://developer.android.com/guide/topics/ui/notifiers/notifications.html\">http://developer.android.com/guide/topics/ui/notifiers/notifications.html
Look at this tutorial from the Android Development site for how to implement notifications: http://developer.android.com/guide/topics/ui/notifiers/notifications.html
这篇关于如何查询从Android电子有限区间web服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!