• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Very slowly connecting to wifi

Ivan Ivanov

Lurker
Feb 26, 2016
1
0
Hello I am new in Android and I am developing a simple app which needs just to connect the device to a particular WiFi network. However, sometimes I need to wait the phone to connect like 3-4 minutes. The code I use for connecting is the following:
Java:
WifiConfiguration robotNetwork=new WifiConfiguration();
                myNetwork.SSID="\""+mySSID+"\"";
                myNetwork.preSharedKey="\""+myPass+"\"";
                int netID=wifi.addNetwork(myNetwork);
                wifi.enableNetwork(netID,true);
                wifi.reconnect();

What am I doing wrong?

Thank you in advance!!!
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones