package cl.monsoon.s1next.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public final class NetworkUtil {

    private NetworkUtil() {}

    /**
     * Check whether the Wi-Fi network connectivity exists and whtether it is possible to
     * establish connections and pass data.
     *
     * @return {@code true} if the Wi-FI network connectivity exists, {@code false} otherwise.
     */
    public static boolean isWifiConnected(Context context) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(
                Context.CONNECTIVITY_SERVICE);
        NetworkInfo networkInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
        return networkInfo != null && networkInfo.isConnected();
    }
}

@@ -124,20 +124,117 @@
 .Network
-Info
+;%0Aimport android.net.NetworkInfo;%0Aimport android.os.Build;%0Aimport android.support.annotation.Nullable
 ;%0A%0Apubli
@@ -544,16 +544,53 @@
      */%0A
+    @SuppressWarnings(%22deprecation%22)%0A
     publ
@@ -799,34 +799,359 @@
     
-NetworkInfo networkInfo = 
+if (Build.VERSION.SDK_INT %3E= Build.VERSION_CODES.LOLLIPOP) %7B%0A            for (Network network : connectivityManager.getAllNetworks()) %7B%0A                if (isNetworkInfoConnected(connectivityManager.getNetworkInfo(network))) %7B%0A                    return true;%0A                %7D%0A            %7D%0A        %7D else %7B%0A            return isNetworkInfoConnected(
 conn
@@ -1181,16 +1181,37 @@
 orkInfo(
+%0A                    
 Connecti
@@ -1232,17 +1232,145 @@
 PE_WIFI)
-;
+);%0A        %7D%0A%0A        return false;%0A    %7D%0A%0A    private static boolean isNetworkInfoConnected(@Nullable NetworkInfo networkInfo) %7B
 %0A       

Check multiple connected networks if API >= 21