1

I am doing a WiFi authentication by below code:

            String networkPass = Constants.Password;
            WifiConfiguration conf = new WifiConfiguration();
            conf.SSID = "\"" + MYSSIDNAME + "\"";  

            conf.preSharedKey = "\""+ networkPass +"\"";

            wifi.addNetwork(conf);
            List<WifiConfiguration> list = wifi.getConfiguredNetworks();
            wifi.disconnect();
            for( WifiConfiguration i : list ) {
                if(i.SSID != null && i.SSID.equals("\"" + MYSSIDNAME  + "\"")) {
                    wifi.enableNetwork(i.networkId, true);
                     break;
                }           
             }      
            wifi.reconnect(); 

It is working fine and no issue with HTC and MOTOROLA but when i am trying to authenticate any NEXUS(MOTOROLA NEXUS 6 & 7),its not working. Any idea will be really appreciated.Thank you :)

Manfred Moser
  • 29,539
  • 13
  • 92
  • 123
Subhalaxmi
  • 5,687
  • 3
  • 26
  • 42
  • What does logcat say? – Pankaj Kumar Oct 15 '15 at 06:25
  • its keep searching for network .. – Subhalaxmi Oct 15 '15 at 06:26
  • In nexus, many time it show only one SSID if more than one SSID has been added with same name. First remove all SSID and then try. – Pankaj Kumar Oct 15 '15 at 06:33
  • Actually , i have to connect to only 1 SSID from the list of available SSID , not to all SSID . Thing is when i am trying to connect its keep going searching for authentication.. Its not ending with any result :( – Subhalaxmi Oct 15 '15 at 06:37
  • Suppose i have 10 SSIDs in my available WiFi list and default i am connected to SSID3, now i want to connect with SSID7. – Subhalaxmi Oct 15 '15 at 06:41
  • I am saying that you can add "xyz" wifi with multiple times. But in actual case only one "XYZ" will have correct configuration to connect. So first delete ""XYZ" and add new one with correct configuration. Note : you will see oly one "XYZ" at a time. when you delete it and if more than one "XYZ" was added you will see another. – Pankaj Kumar Oct 15 '15 at 06:43
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/92351/discussion-between-pankaj-kumar-and-subhalaxmi-nayak). – Pankaj Kumar Oct 15 '15 at 06:43
  • http://stackoverflow.com/questions/8818290/how-to-connect-to-a-specific-wifi-network-in-android-programmatically i checked this also – Subhalaxmi Oct 15 '15 at 07:08
  • I am struggling with same issue.. Please some one help me to get rid this issue. – DJhon Oct 15 '15 at 12:45

0 Answers0