private static boolean checkForExcessOpenNetworkAndSave(final WifiManager wifiMgr,final int numOpenNetworksKept){
  final List<WifiConfiguration> configurations=wifiMgr.getConfiguredNetworks();
  sortByPriority(configurations);
  boolean modified=false;
  int tempCount=0;
  for (int i=configurations.size() - 1; i >= 0; i--) {
    final WifiConfiguration config=configurations.get(i);
    if (ConfigSec.isOpenNetwork(ConfigSec.getWifiConfigurationSecurity(config))) {
      tempCount++;
      if (tempCount >= numOpenNetworksKept) {
        modified=true;
        wifiMgr.removeNetwork(config.networkId);
      }
    }
  }
  if (modified) {
    return wifiMgr.saveConfiguration();
  }
  return true;
}

private static boolean checkForExcessOpenNetworkAndSave ( final WifiManager wifiMgr , final int numOpenNetworksKept ) { final List < WifiConfiguration > configurations = wifiMgr . getConfiguredNetworks ( ) ; sortByPriority ( configurations ) ; boolean modified = false ; int tempCount = 0 ; for ( int i = configurations . size ( ) - 1 ; i >= 0 ; i -- ) { final WifiConfiguration config = configurations . get ( i ) ; if ( ConfigSec . isOpenNetwork ( ConfigSec . getWifiConfigurationSecurity ( config ) ) ) { tempCount ++ ; if ( tempCount >= numOpenNetworksKept ) { modified = true ; wifiMgr . removeNetwork ( config . networkId ) ; } } } if ( modified ) { return wifiMgr . saveConfiguration ( ) ; } return true ; }
ensure no more than numopennetworkskept open networks in configuration list .
