Networking 1 Flashcards
Define a URI…
A Uniform Resource Indicator is a sequence of characters that represent the location of a resource on a network or file.
Define a URL…
A URL is a type of URI specifically for locating resources on a network. It consists of a protocol and domain.
To enable networking in Android, which permissions need to be added? And where to?
To the AndroidManifest.xml
android.permission.INTERNET
android.permission.ACCESS_NETWORK_DRIVE
Which HTTP class does Android provide?
HttpURLConnection
Which protocol does HttpURLConnection support?
TLS (Transport Layer Security)
Why do we offload networking to a designated thread? What might happen if we don’t?
To remove overhead from the UI thread. Otherwise a Activity Not Responding error may occur.
What is a handler?
Handler is an object that is responsible for handling network operations that have been handed off onto a new thread.
What is a hand-off? What data is sent to the handler during the hand-off?
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.
In the sense of maintaining state, why is it important to offload networking operations?
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.