Difference between Service and Broadcast receivers in android

prago picture prago · Jan 17, 2012 · Viewed 22.3k times · Source

I want to know the difference between services and broadcast receivers, can anyone point out an example that can be observed on android mobile devices. Thanks

Answer

Vins picture Vins · Jan 17, 2012

Service: If you want to do something in background , this will be running always in background even if the application closed. You can create this in separate process and also you can give your service to other app if you want. Downloading any content or Music is good example

Broadcast Reciever: Usually system will send some info which can be recieved by your app if you would wish to ,by registering. And you can do something what you want when that thing happens by using onReceive method. Example is the system will send BroadcastReceiver when new sms arrives or Booting done

Here is good article : Service and BroadcastReceiver