code: static boolean isWifi(Context context) {
      if (context == null) {
        return false;
      }
  
      ConnectivityManager manager =
          (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
      if (manager == null) {
        return false;
      }
      NetworkInfo info = manager.getActiveNetworkInfo();
  
      return info != null && (info.getType() == ConnectivityManager.TYPE_WIFI);
    }
docs: To check whether current network is wifi.
  
  @param context context
  @return true if network if wifi, otherwise return false