Back to project page NearestRestaurants.
The source code is released under:
Apache License
If you think the Android project NearestRestaurants 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 com.jiahaoliuliu.nearestrestaurants.utils; /* w w w .j a v a 2 s. c o m*/ import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.util.Log; public class Connectivity { private static final String LOG_TAG = Connectivity.class.getSimpleName(); public static boolean isNetworkAvailable(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); Log.d(LOG_TAG, "Network info " + activeNetworkInfo); return activeNetworkInfo != null && activeNetworkInfo.isConnected(); } }