I am writing a connection to wifi .

Already killed a lot of time, but did not achieve correct work. A bunch of points with the same name appear in the list of connection points.

Here is the connection code:

 registerReceiver(connectionReceiver, intentFilter); int networkId = wifi.getConnectionInfo().getNetworkId(); wifi.removeNetwork(networkId); int netId = wifi.addNetwork(conf); wifi.enableNetwork(netId, true); wifi.reconnect(); unregisterReceiver(this); 

Here is the complete code
I would be very grateful for any help and advice !!!
Duplicate wifi points

    1 answer 1

    Hooray! I found a solution! I have to delete all records of this point:

     List<WifiConfiguration> list = wifi.getConfiguredNetworks(); for( WifiConfiguration i : list ) { wifi.removeNetwork(i.networkId); wifi.saveConfiguration(); } int netId = wifi.addNetwork(conf); wifi.enableNetwork(netId, true); wifi.reconnect();