tags:

views:

80

answers:

2

can anybody tell what is the use of broadcast reciever and give example in android

anybody give time zone change example using broadcast receiver

Thanks

+1  A: 

Think about the broadcast receiver as a normal listener. If you listening for free beer and someone yells "free beer here", than you will react on that :) Thats your real life broadcast receiver example :D

WarrenFaith
Excellent. I would like to add that the guy saying "Free beer here" can also send a big glass of beer using `putExtra()` in the `Intent`.
Macarse
Your right, I must forget it because the last received free beer is so long ago :/
WarrenFaith
+1  A: 

I think the android developers documentation explains it pretty good:

A broadcast receiver is a component that does nothing but receive and react to broadcast announcements. Many broadcasts originate in system code — for example, announcements that the timezone has changed, that the battery is low, that a picture has been taken, or that the user changed a language preference. Applications can also initiate broadcasts — for example, to let other applications know that some data has been downloaded to the device and is available for them to use.

(see developer.android.com)

On your android system broadcasts are used as an instrument of notifications. As the name suggests, they are broadcastet through your whole system. With a broadcast receiver you can catch these broadcast notifications.

Ham