0

Guys I need a hand here.. I have been working on this problem for days now and am pretty desperate.

I developed an Android app that looks for wireless networks starting with some prefix (for example MyWifi_). If it founds a network with this prefix, it tries to establish a connection.

The problem is that in some devices, it connects, but in other devices it founds the network but never connects. The Access Points have always the following configuration:

netConfig = new WifiConfiguration();
netConfig.SSID = "my_prefix" + USER_NICK;
netConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
netConfig.status = WifiConfiguration.Status.ENABLED;
netConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
netConfig.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);

and my connection code:

WifiConfiguration wc = new WifiConfiguration();
wc.SSID = "\"" + network.SSID + "\"";  //'network' is the found network
wc.BSSID = network.BSSID;
wc.priority=1;
wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
wc.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
wc.status = WifiConfiguration.Status.ENABLED;
int netId = wifi.addNetwork(wc);  <---this is working fine... it adds the network
wifi.enableNetwork(netId, true);

Is there something wrong with my WifiConfiguration? I tried changing several things (WEP,WPA,OPEN,connecting only by BSSID) but nothing seems to solve my problem. Do you have any WifiConfiguration that has always worked for you (as Access point and client) ?

Thank you

Sebastian Breit
  • 6,137
  • 1
  • 35
  • 53

1 Answers1

0

Perhaps because of priority (it's just 1). wpa_supplicant may decide not to connect to network with lowest priority. Try to remove this line. However, this is just a theory.

Oleksandr Kravchuk
  • 5,963
  • 1
  • 20
  • 31