Friday, March 30, 2012

Re: [android-developers] Wifi and phone sleep state

On Fri, Mar 30, 2012 at 8:24 AM, Kostya Vasilyev <kmansoft@gmail.com> wrote:
> You would have noticed sooner had you been using my stupid little WiFi
> widget :)

Yeah, well, it might not have been on my primary home screen page.

:-)

> According to my sources
>
> (
> 4.0.1/packages/apps/Settings/src/com/android/settings/wifi/AdvancedWifiSettings.java
> )

IMHO, the SwitchPreference where tapping on the preference *also*
launches a nested PreferenceScreen is lousy UX. I keep forgetting
there are options under the WiFi one, until I'm trying to connect to
some new AP and then eventually stumble upon it. And, of course,
buried inside of there are the advanced settings.

FWIW, the Galaxy Nexus default seems to be always-on -- I toggled mine
back to only-when-plugged-in.

> the policy is stored under:
>
> http://developer.android.com/reference/android/provider/Settings.System.html#WIFI_SLEEP_POLICY

Ah, OK, that's what I was looking for.

> From an application's point of view, though, it's just same old
> ConnectivityManager.getActiveNetworkInfo - the connection is either there
> and it's WiFi, or it's not.

Well, the decision on whether to use a WifiLock would be based in part
on WIFI_SLEEP_POLICY -- if WIFI_SLEEP_POLICY is
WIFI_SLEEP_POLICY_NEVER, you do not need the WifiLock. That was the
point behind your original post on this thread IIRC.

Many thanks!

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 2.5
Available!

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment