2017-02-26 10 views
0

他のいくつかの質問/回答を読み終えても、wifiManager.removeNetworkを使用して問題を解決しています。よるとAndroid - まだWifiネットワークをプログラムで削除できません

Android - Cant Remove Wifi Network Programatically- The method removeNetwork(int) in the type WifiManager is not applicable for the arguments (String)

How to forget a wireless network in android programmatically?

...私のコードは動作するはずです:

WifiManager wifiMAN = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE); 

for (WifiConfiguration wifiCon : wifiMAN.getConfiguredNetworks()) { 
    if (wifiCon.SSID.equals("\""+ targetNetworkName +"\"")) { 
     wifiMAN.removeNetwork(wifiCon.networkId)) { 
     wifiMAN.saveConfiguration(); 
     break; 
    } 
} 

しかし、私はAPI 23でそれをテストするとき動作しません。コードを調べると、何も価値が見えなくなり、コードはAPI 21で動作します。

答えて

関連する問題