Holding a scan wifilock ensures you get alteast scan capabilities and keeps
wifi up - the system is still in control of whether wifi needs to connect
when its turned on

On Wed, Jun 1, 2011 at 10:38 PM, seema <seema22...@gmail.com> wrote:

> Hello All,
>
>           Here is what I do to scan on wifi while connected to 3G.
>
> WifiLock wifiLock =
> wifiService.createWifiLock(WifiManager.WIFI_MODE_SCAN_ONLY,
> "MyLock");
>
>        if(!wifiLock.isHeld()){
>            wifiLock.acquire();
>        }
>
>        if(wifiService.isWifiEnabled() == false){
>             wifiService.setWifiEnabled(true);
>         }
>
> Is my usage of WIFI_MODE_SCAN_ONLY is correct. When I enable Wifi,
> it automatically connects to the remembered network. I just want
> to scan but not connect. The definition of WIFI_MODE_SCAN_ONLY is:
> In this Wi-Fi lock mode, Wi-Fi will be kept active, but the only
> operation that will be supported is initiation of scans, and the
> subsequent reporting of scan results.
>
> Please help me
>
> Regards,
> Seema
>
> --
> 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

Reply via email to