The system can always override to make a connection. scan only wifilock
ensures wifi is not shutdown and kept up for scans.

On Thu, Oct 27, 2011 at 4:14 AM, Vasco Fernandes <
vasco.m.fernan...@gmail.com> wrote:

> Hi,
>
> I'm trying to block the wifi connections. I want my application to turn on
> the wifi, but does not connect to any network that is already stored on the
> smartphone. But even after I use the SCAN_ONLY mode, he continues to connect
> to networks that already "know".
>
>         .....
>         wifiManager = (WifiManager)
> context.getSystemService(Context.WIFI_SERVICE);
>         .....
>         wifiManager.setWifiEnabled(true);
>         WifiLock scanOnly =
> wifiManager.createWifiLock(WifiManager.WIFI_MODE_SCAN_ONLY, "scanOnly");
>
>  scanOnly.acquire();
>
> Already in despair i tried to disconnect after to make sure that the state
> is WIFI_STATE_ENABLED wifi. That the app can not connect for a few seconds,
> but after some time it connects to a network in the same ...
>
>         wifiManager.setWifiEnabled(true);
>         ....
>         WHEN (WIFI STATE == WIFI_STATE_ENABLED)
>         {wifiManager.disconnect();
> scanOnly.acquire();}
>
> Can someone help me?
> Tks
>
> --
> 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