0

i am building a sample app that displays available networks and then prompts users to select the network and asks for the wifi password before connecting and sends that password for wi-fi authentication.My question is how do i send that password for wi-fi authentication. Thanks

  • clear answer to your question is there : http://stackoverflow.com/questions/8818290/how-to-connect-to-a-specific-wifi-network-in-android-programmatically – Blue_Alien Nov 20 '14 at 09:55

1 Answers1

0

clear answer to your question is there :

How do I connect to a specific Wi-Fi network in Android programmatically?

But, this will be suitable for you..bcz u know the SSID solution would look something like this:

WifiConfiguration wifiConfig = new WifiConfiguration();
wifiConfig.SSID = String.format("\"%s\"", ssid);
wifiConfig.preSharedKey = String.format("\"%s\"", key);

WifiManager wifiManager = (WifiManager).getSystemService(WIFI_SERVICE);
//remember id
int netId = wifiManager.addNetwork(wifiConfig);
wifiManager.disconnect();
wifiManager.enableNetwork(netId, true);
wifiManager.reconnect();
Community
  • 1
  • 1
Blue_Alien
  • 2,148
  • 2
  • 25
  • 29