@@ -0,0 +1,2647 @@
+package org.honorato.diagnostics.models;%0A%0Aimport android.annotation.TargetApi;%0Aimport android.content.Context;%0Aimport android.net.ConnectivityManager;%0Aimport android.net.Network;%0Aimport android.net.NetworkCapabilities;%0Aimport android.net.NetworkInfo;%0Aimport android.os.Build;%0A%0Aimport org.honorato.diagnostics.R;%0A%0A/**%0A * Created by jlh on 11/27/15.%0A */%0Apublic class NetworkStaticCheck extends Check %7B%0A%0A    protected ConnectivityManager connectivityManager;%0A%0A    public NetworkStaticCheck(Context context) %7B%0A        super(context);%0A        setTitle(R.string.static_network_title);%0A    %7D%0A%0A    @Override%0A    protected void performCheck() %7B%0A        connectivityManager = (ConnectivityManager) this.context.getSystemService(Context.CONNECTIVITY_SERVICE);%0A        if (Build.VERSION.SDK_INT %3E= 21) %7B%0A            performMultiNetworkCheck();%0A        %7D else %7B%0A            performNetworkCheck();%0A        %7D%0A        boolean isConnected = performWifiCheck();%0A        if (isConnected) %7B%0A            setStatus(STATUS_OK, this.context.getString(R.string.static_network_ok) + %22: %22 + %22WiFi%22);%0A        %7D else %7B%0A            //performCellCheck();%0A        %7D%0A    %7D%0A%0A    @TargetApi(21)%0A    protected void performMultiNetworkCheck() %7B%0A        Network%5B%5D networks = connectivityManager.getAllNetworks();%0A        if (networks.length == 0) %7B%0A            setStatus(STATUS_ERROR, R.string.static_network_no_connection);%0A            return;%0A        %7D%0A%0A        for (Network nw : networks) %7B%0A            NetworkCapabilities nwCapabilities = connectivityManager.getNetworkCapabilities(nw);%0A            if (nwCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED) %7C%7C%0A                    nwCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED)) %7B%0A                setStatus(STATUS_OK, R.string.static_network_ok);%0A                return;%0A            %7D%0A        %7D%0A        setStatus(STATUS_WARNING, R.string.static_network_warning);%0A    %7D%0A%0A    protected void performNetworkCheck() %7B%0A        ConnectivityManager connectivityManager%0A                = (ConnectivityManager) this.context.getSystemService(Context.CONNECTIVITY_SERVICE);%0A        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();%0A        if (activeNetworkInfo != null && activeNetworkInfo.isConnected()) %7B%0A            setStatus(STATUS_OK, R.string.static_network_ok);%0A        %7D else %7B%0A            setStatus(STATUS_ERROR, R.string.static_network_no_connection);%0A        %7D%0A    %7D%0A%0A    protected boolean performWifiCheck() %7B%0A        NetworkInfo mWifi = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);%0A        return mWifi.isConnected();%0A    %7D%0A%7D%0A

Add static network check