From 806a6d797b48f63e36d5fbd418091d8b0c9bc3c7 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Tue, 24 Feb 2015 21:32:24 +0100 Subject: [PATCH] Remove the the network when disabling. --- .../main/java/me/datenknoten/tueroeffner/MainActivity.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/me/datenknoten/tueroeffner/MainActivity.java b/app/src/main/java/me/datenknoten/tueroeffner/MainActivity.java index 1ada524..8d81875 100644 --- a/app/src/main/java/me/datenknoten/tueroeffner/MainActivity.java +++ b/app/src/main/java/me/datenknoten/tueroeffner/MainActivity.java @@ -169,6 +169,12 @@ public class MainActivity extends ActionBarActivity { Toast.makeText(buttonView.getContext(), getString(R.string.wlan_activated), Toast.LENGTH_SHORT).show(); } else { + List 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(); } }