android - Connect to specific network, disable WiFi if the network doesn't exist (My issue in the second part) -


i'm trying add connect specific network, i've made editbox, user enter network wannna connect to, after pressing done, save in sharedpreference, , string , store it.

code deleted, use code in answer .

if initial case connecting network if exist, have boolean , check after while loop see if need disable wifi. like:

    list<wificonfiguration> list = wifimanager.getconfigurednetworks();     boolean connected = false;         for( wificonfiguration : list ) {             if(i.ssid != null && i.ssid.equalsignorecase("\"" + desiredssid + "\"")) {                 log.d("in", "in!");                 wifimanager.disconnect();                 wifimanager.enablenetwork(i.networkid, true);                 wifimanager.reconnect();                 connected = true;                 break;             }     if(!connected){wifimanager.setwifienabled(false);} 

Comments

Popular posts from this blog

Capture and play voice with Asterisk ARI -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -