iOS: Check whether internet connection is available

On April 28, 2012, in iOS, Objective C, by Dipin Krishna

Here, i am just checking whether network connectivity is available to a server and its done synchronously. You can use Reachability if you need notifications when there is any change in the network connectivity. For this you have to include the SystemConfiguration.framework in your project. Now add, #import "SystemConfiguration/SystemConfiguration.h" and the below function to your […]

android.os.NetworkOnMainThreadException due to StrictMode.ThreadPolicy

On April 19, 2012, in Android, Java, by Dipin Krishna

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.