Android Internet Connectivity Check Api

   ConnectivityManager connManager = (ConnectivityManager) contex.getSystemService(Context.CONNECTIVITY_SERVICE);

 android.net.NetworkInfo wifi = connManager
                    .getNetworkInfo(ConnectivityManager.TYPE_WIFI);

 android.net.NetworkInfo mobile = connManager
                    .getNetworkInfo(ConnectivityManager.TYPE_MOBILE);

            if (wifi.isAvailable()) {
                return true;
            } else if (mobile.isAvailable()) {
                return true;
            } else {
                return false;

            }

Comments

Popular posts from this blog

What is Android ?