Hi,

I even tried the wifi locks also. This is what I did

wifiLock = wifiService.createWifiLock(WifiManager.WIFI_MODE_SCAN_ONLY,
"MyLock");

        if(!wifiLock.isHeld()){
            wifiLock.acquire();
        }
        if(wifiService.isWifiEnabled() == false){
             wifiService.setWifiEnabled(true);
         }

But WiFi manager still connects automatically to the remembered
networks after i say enable wifi. Without enabling wifi,
I cannot perform a scan.

Seema

On Apr 22, 6:48 pm, Igor Prilepov <iprile...@gmail.com> wrote:
> Short answer: yes, you can do this.
> First you start scanning WiFi using intent filter
> WifiManager.SCAN_RESULTS_AVAILABLE_ACTION, then get results, analyse them
> and only then select which network to connect to.
> However, as you have found already, if you enabled WiFi and there is a
> "remembered" network then the WiFi manager will connect automatically.
> I guess the solution is in using WiFiLock with 
> WIFI_MODE_SCAN_ONLY<http://developer.android.com/reference/android/net/wifi/WifiManager.h...>
>  key
> - this is exactly what you are looking 
> for:http://developer.android.com/reference/android/net/wifi/WifiManager.h...

-- 
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