This course is available as part of the raywenderlich.com Professional subscription. To learn more click here
Pro

OkHttp Interceptors in Android

May 25 2021 · Video Course (23 mins) · Intermediate

Learn how to use OkHttp Interceptors to intercept network requests, log them and also modify them on the fly.

4/5 2 Ratings

Version

  • Kotlin 1.4, Android 5, Android Studio 4.1

Implementing OkHttp Interceptors

Find out what OkHttp Interceptors are. Learn the difference between Application and Network Interceptors.

1

Generate a TheMovieDB API key and use it to get the starter project running.

2

Log and debug API calls by implementing a custom Interceptor. Learn about the different logging levels.

3

Use a custom logging client to control how the Interceptor logs the API calls and also redact sensitive information from the logs.

4

Implement an Interceptor that adds the API key to all API calls and avoid duplication of effort.

5

Learn how to implement an Interceptor to add custom headers that are useful for analytics.

6

Who is this for?

This course is for Android developers who want to monitor and modify network calls at the application and network levels, in turn simplifying network operations.

Covered concepts

  • Initializing OkHttp Interceptors
  • Choosing between Application and Network Interceptors
  • Logging network data with different log levels
  • Redacting sensitive information from network logs
  • Debugging network errors
  • Adding authentication token to all API calls
  • Adding custom headers useful for analytics

Contributors

Comments