I don't think you need to call startScan after calling enableNetwork. 
 Here's what my book says:


To use a particular network configuration, use the enableNetwork method, 
passing in the network ID to use and specifying true for the 
disableAllOthers parameter: 

// Get a list of available configurations

 List < WifiConfiguration > configurations = wifi.getConfiguredNetworks();

 // Get the network ID for the first one. 

if (configurations.size() > 0) { int netID = configurations.get( 0). 
networkId;

 // Enable that network.
 boolean disableAllOthers = true;
 wifi.enableNetwork( netID, disableAllOthers);
 }

Meier, Reto (2012-04-05). Professional Android 4 Application Development 
(Wrox Professional Guides) (Kindle Locations 17962-17968). John Wiley and 
Sons. Kindle Edition. 



On Thursday, February 7, 2013 11:50:42 AM UTC-6, Kostya Vasilyev wrote:
>
> That's half of it. The other half is calling WifiManager.startScan() to 
> actually trigger the {re}connect.
>
> -- K
>
> On Thursday, February 7, 2013 8:52:05 PM UTC+4, bob wrote:
>>
>> I think you call this function in WifiManager:
>>
>> boolean
>> *enableNetwork*(int netId, boolean disableOthers)
>> Allow a previously configured network to be associated with.
>>
>>
>>
>> On Thursday, February 7, 2013 10:35:51 AM UTC-6, Raneez wrote:
>>>
>>> My application (supports 2.2 and later) needs to connect with a *wifi 
>>> device* like 
>>> FlashAir<http://www.toshiba-components.com/FlashAir/index.html> after 
>>> scanning networks using 
>>> WifiManager<http://developer.android.com/reference/android/net/wifi/WifiManager.html>
>>> .
>>>
>>> Is it possible to connect to a device from the *application ? *or is it 
>>> only possible by scanning and connecting devices from settings?
>>>
>>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to