Android Networking
HTTP, REST API, Retrofit, OkHttp, JSON parsing, Network security
1Which permission is needed to access Internet?
Which permission is needed to access Internet?
답변
The permission <uses-permission android:name='android.permission.INTERNET' /> must be declared in AndroidManifest.xml. It's a normal permission (not dangerous) that doesn't require runtime request. Without this permission, any network connection attempt will fail with a SecurityException.
2What is Retrofit?
What is Retrofit?
답변
Retrofit is a type-safe HTTP client for Android and Java developed by Square. It turns an HTTP API into a Java/Kotlin interface with annotations. Retrofit automatically handles JSON serialization/deserialization, asynchronous requests, and integrates with OkHttp, Coroutines, RxJava. It's Google's recommended solution for network calls.
3What are the main HTTP methods?
What are the main HTTP methods?
답변
Main HTTP methods are: GET (retrieve resources), POST (create a resource), PUT (completely update a resource), PATCH (partial update), DELETE (delete a resource), HEAD (retrieve headers only), OPTIONS (communication options). GET and DELETE are idempotent, POST is not.
What is the HTTP GET method used for?
What is the HTTP POST method used for?
+26 면접 질문