Back to project page UTMShuttleAndroid.
The source code is released under:
GNU General Public License
If you think the Android project UTMShuttleAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package util; //w w w .j a v a2 s.c o m import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class NetworkHelper { /** * Checks if there's an Internet connection and returns true iff there is. * * @return True iff there is an Internet connection available. */ public static boolean isNetworkAvailable(Context context) { if (context != null) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null && activeNetworkInfo.isConnected(); } return false; } }