Networking 1 Flashcards

1
Q

Define a URI…

A

A Uniform Resource Indicator is a sequence of characters that represent the location of a resource on a network or file.

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

Define a URL…

A

A URL is a type of URI specifically for locating resources on a network. It consists of a protocol and domain.

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

To enable networking in Android, which permissions need to be added? And where to?

A

To the AndroidManifest.xml
android.permission.INTERNET
android.permission.ACCESS_NETWORK_DRIVE

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

Which HTTP class does Android provide?

A

HttpURLConnection

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

Which protocol does HttpURLConnection support?

A

TLS (Transport Layer Security)

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

Why do we offload networking to a designated thread? What might happen if we don’t?

A

To remove overhead from the UI thread. Otherwise a Activity Not Responding error may occur.

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

What is a handler?

A

Handler is an object that is responsible for handling network operations that have been handed off onto a new thread.

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

What is a hand-off? What data is sent to the handler during the hand-off?

A

Hand-off is the process of the UI thread handing off the networking operations to a designated or anonymous thread.
The data that is sent is:
Runnable -> An implementation of the runnable interface.
Message -> Objects, data and values needed for the networking operations.

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

In the sense of maintaining state, why is it important to offload networking operations?

A

If a config change occurs via rotation or similar, the networking processes will persist if they are not on the UI thread. Hence, handing-off prevents network operation interruptions.

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