Android Networking: Fundamentals

3 versions

Learn about HTTP, JSON, REST and all the other cool and important abbreviations in the world of networking! Implement the Retrofit library in Android, add interceptors, parsers, and Kotlin Coroutines. By Filip Babić.

4.6 (11) ·

Download materials
Save for later
Share

Who is this for?

Beginner Android developers who want to learn how to use all the Networking capabilities the platform provides such as HTTP connections, Retrofit, and Kotlin Coroutines.

Covered concepts

  • HTTP - HyperText Transfer Protocol
  • Threading basics
  • JSON - JavaScript Object Notation
  • REST - Representational State Transfer
  • HttpURLConnection
  • Parsers & Data parsing
  • Gson Parser
  • Retrofit & REST methods
  • OkHttp
  • Queries
  • Moshi Parser
  • Kotlin Serialization
  • Logging & Authentication Interceptors
  • Custom error handling
  • Kotlin Coroutines
  • Suspend functions
  • Retrofit with coroutines

Part 1: Learn About HTTP & Threading

1
Toggle description

Learn about all the concepts you'll cover in this course, such as REST, JSON, HTTP, Retrofit, Coroutines and more!

Toggle description

Install the required tools to open and work on the Taskie app, and explore the Android Studio project you'll work on. You need to have Android Studio 3.6 or greater installed.

Toggle description

Add the required permissions to the Android Manifest file, and implement a way to check if the device is connected to the Internet.

Toggle description

Learn how to create an HTTP connection, and how to send and receive data using streams. Add timeouts and headers, receive data as JSON.

Toggle description

Learn what JSON is. Use the native mechanism of JSONObjects to parse the response from a new request - login. Extract data from JSON using keys.

Toggle description

Create another HTTP request using the HttpURLConnection, to practice your skills. Parse the JSON and connect the response to the UI.

Toggle description

Learn about JSON structures and how they correlate to Kotlin code. Use the Gson parser for automatic parsing.

Toggle description

Create another request with the HttpURLConnection, as practice, and use what you've learned so far to parse the data from JSON.

Conclusion 1:34
Toggle description

Revise the concepts learned in the first part of the course, and how some things were repetitive. Have a sneek peak at the next part of the course.

Part 2: Implement Retrofit Basics

Toggle description

Revise the concepts you've learned in the first part of the course. Learn about Retrofit and the components that make it up.

Toggle description

Build the OkHttpClient, Retrofit and the RemoteApiService instance, to prepare everything for API call implementation.

Toggle description

Use Retrofit and its annotations, to implement an API request in the api service. Learn about the Call and Callback types in Retrofit.

Toggle description

Use Retrofit to implement a GET call, to fetch data from the API, and display it in the app. Compare the approach to HttpURLConnections.

Toggle description

Practice using Retrofit and its annotations, to implement a new API call. Practice parsing the response body.

Toggle description

Introduce the Query annotation, to send query parameters to the server. Learn about query URL segments. Implement a second call.

Toggle description

After using the Gson parser manually, learn how to use the Moshi parser to automatically parse the request and response bodies.

Toggle description

Repeat and practice what you've learned about the Moshi parser, and implement another request in which you'll parse data using Moshi.

Conclusion 1:32
Toggle description

Go over everything you've learned in the second part! Introduce some advanced concepts like interceptors and other parsers from the third part.

Part 3: Expand Upon Retrofit

Toggle description

Revise the concepts learned so far. Go over some of the repetitive tasks you had to complete with Retrofit, and how to solve them.

Toggle description

Implement a third way to parse data, which is light and supports multiplatform - Kotlin Serialization. Compare to other parsers.

Add logging interceptors to Retrofit's client, to log information to analyze each request. Implement a custom error handling mechanism.

Toggle description

Practice using HTTP logging interceptors and the Result error handling, by implementing more requests.

Toggle description

Learn about another way to use interceptors, to add authentication headers to requests. Explore the interceptor request chain.

Practice implementing more Retrofit requests, to add a DELETE method to the api service.

Conclusion 1:46
Toggle description

Go over all the cool concepts you've covered in the third part of the course. Prepare for the last part of the course, and Kotlin Coroutines!

Part 4: Retrofit With Kotlin Coroutines

Toggle description

Get an introdution to Kotlin Coroutines and learn about how Retrofit has built in support. Discover why coroutines are a modern way of threading and networking.

Remove the Callback object from Retrofit, and wrap calls in Kotlin Coroutines to simplify the code and make it more understandable.

Simplify the coroutine-powered api calls even more, by implementing the built-in coroutines support in Retrofit.

Toggle description

To finish off the course, and practice learning about Kotlin Coroutines in Retrofit, simplify the rest of the calls!

Conclusion 2:08
Toggle description

Good job reaching the end of the course! :] Explore future courses and advanced topics in threading and networking.