Component- 3.Broadcast Receivers

Broadcast Receivers
  • A broadcast/Intent receiver is a component that receives and reacts to broadcast announcements.    
  • Applications can also initiate broadcasts
                  Example: to let the other applications know that some data has been downloaded and is available for them to use
  • They also respond to a system-wide announcement of an event
  • Announcements can come :   internally, say from OS – Battery Low / timezone change or from other applications.
  • Broadcast receiver components are used to listen to the announcements made by other application components through intents.
  •  Broadcast receivers can respond to the announcements in following ways:
  1.  Starting an activity
  2. Starting a service
  3. Alert using notifications
  •  Broadcast receivers does not have any user interface.
  • They also respond to a system-wide announcement of an event
  • Announcements can come as
                  internally, say from OS – Battery Low / timezone change or from other applications
 There are two major classes of broadcasts that can be received:
  • Normal broadcasts (sent with Context.sendBroadcast) are completely asynchronous. All receivers of the broadcast are run in an undefined order, often at the same time. This is more efficient, but means that receivers cannot use the result or abort APIs included here.
  • Ordered broadcasts (sent with Context.sendOrderedBroadcast) are delivered to one receiver at a time. As each receiver executes in turn, it can propagate a result to the next receiver, or it can completely abort the broadcast so that it won't be passed to other receivers. The order receivers run in can be controlled with the android:priority attribute of the matching intent-filter; receivers with the same priority will be run in an arbitrary order.

Comments

Popular posts from this blog

Android Objective type Question and Answers

Android Questions and Answers for written exams

Android Interview questions