Thanks Kostya, I think I'm nearly there.

My current problem is adding a new configured access point.

I have it hard coded in my code as follows:

---

        WifiConfiguration wc = new WifiConfiguration();
        wc.SSID = '"'+scanResult.SSID+'"';
        wc.status = WifiConfiguration.Status.ENABLED;
        wc.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);

wc.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
        wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
        wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
        wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);

wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);

wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
        wc.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
        wc.allowedProtocols.set(WifiConfiguration.Protocol.WPA);
        int res = mainWifi.addNetwork(wc);
        Log.d("WifiPreference", "add Network returned " + res );
        boolean b = mainWifi.enableNetwork(res, true);
        Log.d("WifiPreference", "enableNetwork returned " + b );

--

But is there a way I can get the information needed from a Scan Result to
add a new Wifi configuration? Things like PairwiseCiphers, Protocols,
AuthAlgorithms, KeyManagement I cant see a method to retrieve that info from
a Scan result.

Is it possible?

2010/5/14 Kostya Vasilyev <kmans...@gmail.com>

> Donald,
>
> Yes, your algorithm is correct. Only add network from the scan list to the
> known list if not already there.
>
> As for scanning on the move, take a look at wake locks.
>
> 14 мая, 2010 5:35 PM пользователь "Donal Rafferty" <draf...@gmail.com>
> написал:
>
>
> Thanks again Kostya,
>
> I have downloaded your app and had a look, its very nice, the widget will
> come in very handy for my testing!
>
> I was aware of the "known" versus as is quotes.
>
> My problem is for my app to work I need it to scan for AP's when the device
> is on the move.
>
> So it should scan, find a new AP that has the highest RSSI in the area and
> connect to that.
>
> The problem is I can only connect to a "known" or already configured AP and
> not one resulting from a scan.
>
> So would I be correct in saying that I need to do the following?
>
> Scan
> Get the highest RSSI
> Compare the SSID of this AP to the Wifi Config list
> If its in the Wifi config list then connect
> If its not then add a new access point (As a configured AP)
> Get the id of the newly added AP and connect
>
>
> On Fri, May 14, 2010 at 1:47 PM, Kostya Vasilyev <kmans...@gmail.com>
> wrote: > > Donal, > > I think...
> --
>
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group...
>
>  --
> 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<android-developers%2bunsubscr...@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

Reply via email to