I'm working on an application with a number of activities, including a
MapViewActivity. The map has markers drawn on it as overlays. The
marker data is retrieved by regularly polling a web server, which
returns a JSON document. The data can change from time to time, and
when it does the map must be updated promptly.

What's the recommended way to poll the web server in the background
and update the map? I considered using a service, but ran into
problems with accessing the map overlays variables. The other approach
which springs to mind is to user a TimerTask (maybe calling an
AsyncTask if necessary to avoid blocking the UI thread) from the
MapViewActivity.

Another consideration is that it would be nice to continue polling
when in other activities within the same application. This way when
the user switches to the map activity, the map is already up to date.
This is not a hard requirement though.

Thoughts?

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

Reply via email to