Lecture 15: Introduction to Broadcasts Flashcards
Broadcasts in Android are a way of ____
notifying other applications or activities that some kind of event has taken place
The Android system itself uses broadcasts to notify applications when ___
system events have taken place
Applications may set up ___ to read broadcasts and ___ to send them
Applications may set up ___ to read broadcasts and ___ to send them
The most common purpose of a broadcast receiver is to receive __ notifications
system level
Introduction to Broadcasts
- ACTION_BATTERY_LOW
- ACTION_CHARGING
- ACTION_HEADSET_PLUG
- ACTION_USB_ACCESSORY_ATTAHED
- ACTION_DATE_CHANGED
Write code to declare a broadcast receiver in the app manifest
<receiver>
<intent-filter>
<action></action>
</intent-filter>
</receiver>
The broadcast receiver takes an ___, which in turn names an __ that we will be “listening” for
- intent filter
- action
____ is required if using external broadccasts, if only listening for internal broadcasts this can be ___
- exported=true
- false
Once the receiver has been declared in the app manifest, you can make a ___ for the receiver. It overrides one method called onReceive which ___
- Java Class
- opens an activity and displays a toast popup
Manifest-declared receivers can ____ when they receier a ___
- wake up
- broadcast
Manifest-declared receivers are always ___ for broadcasts
listening
_____ receivers cant be turned off and will aways trigger
Manifest-declared
Receivers are __ on application install and then treated as separate ___ for your application
- registered
- launching entrypoint
When a broadcast is made and caught by the receiver, ___
the OnReceive method is called and the broadcast receiver is “active”
Once the OnReceive method resolves, the receiver ___
returns to its dormant “waiting” state