Lecture 16: Sending Broadcasts & Ordered Broadcasts Flashcards
The simplest implementation of sending broadcasts just uses the __ method with a __
- sendBroadcast()
- custom intent
The intent only requires a defined __
action
Write simple code making an intent and sending a broadcast
Intent intent = new Intent();
intent.setAction(“com.cosc326.broadcast.MY_COOL_ACTION”);
sendBroadcast(intent);
The only alternation required to the previous manifest-registered receiver is a ___
change to the action of the intent filter
The action specific in the intent-filter must be __
identical to the action specified in the intent used to generated the broadcast
We can filter who actually receives broadcasts based on metrics such as?
permissions, package, ordering
We can also change the ___ and ___ of when broadcasts are received
- ordering
- timing
How can you filter which receivers get a broadcast based on package
Use setPackage() on the custom intent before calling sendBroadcast()
Intent intent = new Intent();
intent.setAction(“com.cosc326.broadcast.MY_COOL_ACTION”);
intent.setPackage(“com.326”);
sendBroadcast(intent);
How can you filter which receivers get a broadcast based on permission
Require the receiver to have permissions to get the broadcast
To send with a permission requirement, we can ___
reference the permission with Manifest.permission and pass it as a second argument to sendBroadcast
Intent intent = new Intent();
intent.setAction(“com.cosc326.broadcast.MY_COOL_ACTION”);
sendBroadcast(intent, Manigst.permission.BLUETOOTH_CONNECT)
What is a orded broadcast
A more specialized form of broadcast that allows for ordering priority of receivers and the passing of data from one receiver to the next
What does a bucket brigade refer to?
A broadcast may be caught be a receiver and the results then forwarded on to the next receiver in the ordered queue until a receiver aborts it
While an ordered broadcast can use permissions and package name filtering like a normal broadcast, it primarily uses __
An integer priority to determine which receiver gets the broadcast first
How do ordered broadcasts work differently than typical broadcasts?
They are asynchronous meaning that an ordered broadcast call immediately returns while the broadcast is passed around in the background.
The broadcast is not sent to all receivers at once, only to the first receiver in the order queue.
When using an integer priority the higher the priority value the ___
More likely it is the receiver is the preferred receiver for the broadcast