Answers for "android check internet connection library"

0

how-to-check-internet-connection-in-android

public static boolean isNetworkConnected(Context context) {
        ConnectivityManager cm = (ConnectivityManager) context
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo ni = cm.getActiveNetworkInfo();
        if (ni == null) {
            // There are no active networks.
            return false;
        } else {
            return true;
        }

    }
Posted by: Guest on January-25-2021

Code answers related to "android check internet connection library"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language