On Wed, Feb 2, 2011 at 12:36 PM, CliffG <[email protected]> wrote:
> Hello,
> I am working on an Android platform that needs to periodically poll a
> server to determine if a file (XML) has changed and if so, download
> that file to the device. This is a new application and am new to
> Android so looking for some help in setting this up. I was thinking of
> creating a Service that handles the file checking and downloading, it
> could be triggered by the AlarmManager every x minutes. The file is
> small and the server and device are on a local network.

Use an IntentService, possibly a WakefulIntentService if this needs to
go on even if the device is asleep:

https://github.com/commonsguy/cwac-wakeful

Make the polling period configurable, including a "please, for the
love of all that is holy, don't poll, I'll request it manually"
option. Users may not necessarily appreciate your polling, even if you
think it's really nice.

If you specifically need to do the download over WiFi, things will get
a bit messy, as the WiFi radio tends to turn off when the device goes
to sleep, and so it might not be on when your alarm goes off (again,
only relevant if you're waking up the device to download the file).

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in London: http://bit.ly/smand1 and http://bit.ly/smand2

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to