code: @SuppressWarnings("MissingPermission")
      static boolean getWifiConnected(Context context) {
          if (context != null && PackageManager.PERMISSION_GRANTED == context.checkCallingOrSelfPermission(Manifest.permission.ACCESS_NETWORK_STATE)) {
              ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
              NetworkInfo wifiInfo = null;
              if (connManager != null) {
                  wifiInfo = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
              }
              return ((wifiInfo != null) && wifiInfo.isConnected());
          }
          return false;
      }
docs: <p>Use this method to query the system state to determine whether a WiFi connection is
  available for use by applications installed on the device.</p>
  This applies only to WiFi connections, and does not indicate whether there is
  a viable Internet connection available; if connected to an offline WiFi router for instance,
  the boolean will still return <i>true</i>.
  
  @param context Context.
  @return <p>
  A {@link boolean} value that indicates whether a WiFi connection exists and is open.
  </p>
  <ul>
  <li><i>true</i> - A WiFi connection exists and is open.</li>
  <li><i>false</i> - Not connected to WiFi.</li>
  </ul>