Remove the the network when disabling.

This commit is contained in:
Tim Schumacher 2015-02-24 21:32:24 +01:00
parent 1f5690245d
commit 806a6d797b

View file

@ -169,6 +169,12 @@ public class MainActivity extends ActionBarActivity {
Toast.makeText(buttonView.getContext(), getString(R.string.wlan_activated), Toast.LENGTH_SHORT).show(); Toast.makeText(buttonView.getContext(), getString(R.string.wlan_activated), Toast.LENGTH_SHORT).show();
} else { } else {
List<WifiConfiguration> list = wifiManager.getConfiguredNetworks();
for (WifiConfiguration i : list) {
if (i.SSID != null && i.SSID.equals(networkSSID)) {
wifiManager.removeNetwork(i.networkId);
}
}
Toast.makeText(buttonView.getContext(), getString(R.string.wlan_deactivated), Toast.LENGTH_SHORT).show(); Toast.makeText(buttonView.getContext(), getString(R.string.wlan_deactivated), Toast.LENGTH_SHORT).show();
} }
} }