Archive
April 2012
2 notes.
iOS: Check whether internet connection is available
Updated for 2026: this tutorial is from 2012. For a current version in SwiftUI, see SwiftUI: Check Internet Connection with NWPathMonitor. Here, i am just checking whether network…
android.os.NetworkOnMainThreadException due to StrictMode.ThreadPolicy
StrictMode.ThreadPolicy was introduced since API Level 9 and the default thread policy had been changed since API Level 11, which in short, does not allow network operation (include HttpClient and HttpUrlConnection) get executed on UI thread. if you do this, you get NetworkOnMainThreadException.