• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

When should I be using Service and BroadcastReceiver?  RSS feed

 
Ranch Hand
Posts: 228
Android IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a bit of an android hobbyist, teaching myself as I go etc.

So far all my apps have been pretty simple, using a handful of activities to do basic tasks

My question is, what does the Service or BroadcastReceiver class/feature give me?

An example of one of my apps : 2 tabs, one shows contacts, the other shows them on the map. How would I benefit from service/broadcastreceivers here? I'm doing a geocoding call, should I migrate that over to the service?
 
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Service runs in the background and has no UI, so I don't see how it would help in the scenario you describe. See http://marakana.com/forums/android/examples/60.html for a Service example.

I'd say any background network calls that are triggered by user actions are candidates for implementation with an android.os.AsyncTask; writeup at http://developer.android.com/resources/articles/painless-threading.html
 
James Elsey
Ranch Hand
Posts: 228
Android IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the links Lester, will give them a read tonight
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!