Neil,
Thanks for the catch on the SSID. Actually, I find that I can only connect
when I do not specify the SSID. Documentation on wifi management is a little
hard to come by. I am learning the wifi packages and device/driver
functionality through trial and error, logging, and network monitoring. I'll
eventually get there.
Dan
On Feb 3, 2010, at 5:11 AM, Neil wrote:
> I can't help with your protocol question, but the reason why
> specifying the SSID isn't working is because it needs to be a quoted
> value, e.g.
>
> wifiConfig.SSID = "\"test\"";
>
> Neil
>
>
> On Feb 2, 8:30 pm, Daniel Rolph wrote:
>> After digging around a little, I was able to put together the code to
>> programmatically connect to an open network/AP. For some reason, specifying
>> the SSID causes the code not to connect.
>>
>> WifiConfiguration wifiConfig = new WifiConfiguration();
>> wifiConfig.BSSID = "00:0C:41:F5:B0:08";
>> wifiConfig.priority = 1;
>> wifiConfig.allowedKeyManagement.set(KeyMgmt.NONE);
>> wifiConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
>> wifiConfig.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
>> wifiConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
>> wifiConfig.status=WifiConfiguration.Status.ENABLED;
>>
>> WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
>> int netId = wifi.addNetwork(wifiConfig);
>> wifi.enableNetwork(netId, true);
>>
>> I am curious about the behavior of the network activity that I am seeing.
>> The N1 is constantly broadcasting Probe Requests. The Access Point is
>> sending out Probe Responses. When I enable the network with the SDK, the
>> N1 sends out a Probe Response with the SSID of the AccessPoint (probably
>> determined from the Probe Response). The N1 then sends out an Association
>> Request to the AP and negotiates the connection. Why can't I initiate an
>> Association Request to the AP prior to receiving the AP Probe Response?
>> Basically, I would like to already have the AP defined in my
>> WifiConfiguration and be sending Association Requests prior to being in
>> range of the AP. Is this possible or am I constrained by the protocol?
>>
>> Thank you very much!
>>
>> Dan
>>
>> On Feb 1, 2010, at 8:21 AM, Daniel Rolph wrote:
>>
>>
>>
>>> 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/AP. The code
>>> snippet that I am using is:
>>
>>> WifiConfiguration wifiConfig = new WifiConfiguration();
>>> wifiConfig.BSSID="00:0C:41:F5:B0:08";
>>> wifiConfig.SSID="test";
>>> WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
>>> wifi.setWifiEnabled(true);
>>> 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!
>>
>>> Dan
>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Developers" group.
>>> To post to this group, send email to android-developers@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> android-developers+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en