Answers for "android code check internet connection"

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 code check internet connection"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language