Android: Intercept on no internet connection

Photo by Rundall Bruder on Unsplash

I have blog compare iOS and Android networking previously. iOS with Alamofire library automatically provide capability to detect when data connection is not on. However Android OkHttp library does provide that by default.

So in this blog, I’ll show how to setup no internet connection detection naturally in OkHttp, which only needs to be done once in your code, and used by all network…




Sharing iOS, Android and relevant Mobile App Development Technology and Learning

Recommended from Medium

Transforming picture with Android Canvas’ DrawBitmapMesh

Understand Kotlin Function Literal with Receiver by Example

7 Gotchas When Explore Kotlin Coroutine

M1 Android Emulator Not Detected Workaround

Android Image Lighting Control and Color Filtering

Android Jetpack Compose: Inset Padding Made Easy

Learn Dagger 2 from Dagger Hilt

Flutter Easy Rich Text

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Sharing Software Development Experience, focus on Mobile.

More from Medium

Setting UserAgent in Android Webview

Kotlin Flows in Android summary

Sending View Model Events to the UI