Lecture 16: Sending Broadcasts & Ordered Broadcasts Flashcards

1
Q

The simplest implementation of sending broadcasts just uses the __ method with a __

A
  • sendBroadcast()
  • custom intent
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The intent only requires a defined __

A

action

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Write simple code making an intent and sending a broadcast

A

Intent intent = new Intent();
intent.setAction(“com.cosc326.broadcast.MY_COOL_ACTION”);
sendBroadcast(intent);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The only alternation required to the previous manifest-registered receiver is a ___

A

change to the action of the intent filter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The action specific in the intent-filter must be __

A

identical to the action specified in the intent used to generated the broadcast

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

We can filter who actually receives broadcasts based on metrics such as?

A

permissions, package, ordering

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

We can also change the ___ and ___ of when broadcasts are received

A
  • ordering
  • timing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How can you filter which receivers get a broadcast based on package

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How can you filter which receivers get a broadcast based on permission

A

Require the receiver to have permissions to get the broadcast

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

To send with a permission requirement, we can ___

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a orded broadcast

A

A more specialized form of broadcast that allows for ordering priority of receivers and the passing of data from one receiver to the next

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does a bucket brigade refer to?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

While an ordered broadcast can use permissions and package name filtering like a normal broadcast, it primarily uses __

A

An integer priority to determine which receiver gets the broadcast first

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do ordered broadcasts work differently than typical broadcasts?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

When using an integer priority the higher the priority value the ___

A

More likely it is the receiver is the preferred receiver for the broadcast

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do you send ordered broadcasts

A

Call sendOrderedBroadcast() with the intent

This will automatically pass the broadcast to the receiver with a matching intent and the highest possible priority value

17
Q

The broadcast receiver that is handling the ordered broadcast will have an ___ method just like a normal receiver

A

onReceive()

18
Q

Within the onReceive() method used to handle ordered broadcasts the receiver with either ___ or ___

A
  • Call abortBroadcast() to terminate the current ordered broadcast
  • Call setResult() which will allow you to pass along a result code, some data and optional extras
19
Q

Like receiving a broadcast, sending a broadcast doesn’t require any specific system ___ in most cases

A

permissions

20
Q

You may not use default system intents for your broadcast, you must use a ___ that identifies the ___

A
  • Custom intent
  • package that the intent originated from and is unique
21
Q

Additional ___ can be added such as requiring permissions or restricting broadcasts to particular package namespaces

A

filtering elements

22
Q

For even more control, ordered broadcasts allow ___ to take part in one ___ in an orderly form

A
  • multiple receivers
  • broadcast