Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to poll a webservice at finite interval from 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.

like image 201
soumitra chatterjee Avatar asked Feb 10 '12 11:02

soumitra chatterjee


1 Answers

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.

Please see my answer on a similar question that uses an Alarm from the AlarmManager:

Running task periodicaly(once a day/once a week)

Edit:

Look at this tutorial from the Android Development site for how to implement notifications: http://developer.android.com/guide/topics/ui/notifiers/notifications.html

like image 94
Graham Smith Avatar answered Oct 06 '22 23:10

Graham Smith