1. Download our Official Android App: Forums for Android!

Apps Very slowly connecting to wifi

Discussion in 'Android Development' started by Ivan Ivanov, Feb 26, 2016.

  1. Ivan Ivanov

    Ivan Ivanov Lurker
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    1
    Joined:
    Feb 26, 2016

    Feb 26, 2016
    1
    0
    15
    Male
    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:
    Code (Java):
    1. WifiConfiguration robotNetwork=new WifiConfiguration();
    2.                 myNetwork.SSID="\""+mySSID+"\"";
    3.                 myNetwork.preSharedKey="\""+myPass+"\"";
    4.                 int netID=wifi.addNetwork(myNetwork);
    5.                 wifi.enableNetwork(netID,true);
    6.                 wifi.reconnect();
    7.  
    What am I doing wrong?

    Thank you in advance!!!
     

    Advertisement

Share This Page

Loading...