Broadcast Receivers Flashcards

1
Q

What is a Broadcast Receiver?

A

1 of the 4 components. They are used to catch broadcast intents.

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

What do Broadcast Receivers catch?

A

Broadcast Intents.

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

What are the 5 steps of the Broadcasting Process? Describe each…

A

1) Create a Broadcast Receiver class that implements onReceive and extend BroadcastReceiver.
2) Register the Broadcast Receiver in the apps Manifest. <receiver>
3) Listen for a Broadcast Intent.
4) BroadcastReceiver receives the broadcast.
5) Call the onReceive method to respond to the broadcast in a specified way.</receiver>

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

What is a Broadcast Intent?

A

An intent that is broadcast by the system or an application. The broadcast is delivered to all registered Broadcast Receivers. An example is when the system sends out a low battery broadcast intent.

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

What can’t Broadcast Intents do?

A

Start an activity.

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

What methods sends a Broadcast Intent?

A

sendBroadcast( ).

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

What are the 2 types of Broadcast Intent? Define each…

A

System Broadcast Intent -> Send by the OS to notify user, apps and components of system events. For example, power connected or battery charged.
Custom Broadcast Intent -> A customised intent that is sent by an application under custom conditions.

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

Define what a Sticky Broadcast Intent is…

A

Intents that persist until they have been received by a Broadcast Receiver.

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

Where are Sticky Broadcast Intents held whilst waiting for a Broadcast Receiver?

A

In a cache.

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

Why are Sticky Broadcast Intents not suitable for sending sensitive information?

A

Because they are public when waiting to be received, thus aren’t suitable for sensitive information.

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

Define what a Non-Sticky Broadcast Intent is…

A

An intent that is discarded straight after it is sent. Thus, if a receiver doesn’t register it immediately, it doesn’t get store in the cache, but is destroyed instead.

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

What are the 3 methods that can be used to send custom intents?

A

sendBroadcast( )
sendOrderedBroadcast( )
sendStickyBroadcast( )

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

If an application wants to listen for a specific Broadcast, what does it need to do?

A

Register a Broadcast Receiver component in the manifest. The Broadcast Receiver must be registered to the intent.

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

To create a Broadcast Receiver, what class must you extends, and what method but be implemented?

A

MyReceiver extends BroadcastReceiver

Must define onReceive( )

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

What is the purpose of Broadcast Permissions in the Broadcast Intent?

A

Ensures that only Broadcast Receivers with the specified Permissions can receive the intent.

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

What 2 ways can Broadcast Receiver Permissions be set?

A

Programatically.
In the Manifest.

17
Q

What does the LiveData class enable?

A

It enables Broadcast Intents to be delivers and received within the same application.