Detect whether there is an Internet connection available on Android [duplicate]

This question already has answers here: Closed 10 years ago. Possible Duplicate: How to check internet access on Android? InetAddress never timeouts I need to detect whether the Android device is connected to the Internet. The NetworkInfo class provides a non-static method isAvailable() that sounds perfect. Problem is that: NetworkInfo ni = new NetworkInfo(); if … Read more