guich wrote: > If it runs in the program's thread, why not create just a separate > thread (or AsyncTask) to do the job?
The use of threads and AsyncTasks is orthogonal to the use of services. You use an AsyncTask (or a manually-created thread) if you want something to be done off the main application thread. You use a Service if you want something to be processing without an Activity around. > Can a service keep running in the background? That depends on what you mean. Services can run without activities; services are not meant to run forever. http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-are-not/ > For example, i want to > create a task that will continuously be polling data from a server, > even if the main application is not running. Can this be achieved with > a Service? Ideally using an AlarmManager and an IntentService (perhaps a WakefulIntentService). http://github.com/commonsguy/cw-advandroid/tree/master/SystemServices/Alarm/ -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.3 Available! -- 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

