1. Check out our companion app, Forums for Android! Download from Google Play

Using WifiManager to connect to a network

Discussion in 'Application Development' started by derolph, Jan 31, 2010.

  1. derolph

    derolph New Member
    Thread Starter

    Jan 31, 2010
    Software Engineer
    Hello everyone,

    I am using a Nexus One with 2.1 SDK. I am having problems with a module in my application connecting programmatically to a network. The code snippet that I am using is:

    WifiConfiguration wifiConfig = new WifiConfiguration();
    WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    int netId = wifi.addNetwork(wifiConfig);
    wifi.enableNetwork(netId, true);

    Monitoring the network, I see probe requests transmitting from the device, but I do not see an Authentication/Association request to the access point that I specify in the BSSID. Ultimately, I will perform a scan to determine valid AP BSSIDs, but for testing, I simply want to connect to a test AP which is in close proximity to my Nexus One.

    I have set the appropriate permissions in my manifest xml and am not seeing any negative log statements from adb.

    Any pointers or suggestions with using WifiManager to perform this action would be very appreciated.

    Thank you very much!



Share This Page