No I'm testing on a Nexus...

But I can't be responsible for user's individual settings, so I'll
just have to assume that in some cases the network will not be
available during the night. Unless there's a command to explicitly
wake up the connection?

On Feb 5, 3:42 pm, Kostya Vasilyev <kmans...@gmail.com> wrote:
> Interesting.
>
> I take it by wireless you mean cellular?
>
> My HTC Hero has an option for "always on cellular data connection" - I
> guess it's specific to HTC phones, as neither my Samsung Galaxy S or
> Motorola Milestone have that.
>
> Is your phone made by HTC by any chance? If so, perhaps you could check
> that setting.
>
> -- Kostya
>
> 05.02.2011 18:22, Neilz пишет:
>
>
>
> > Yes, looking at the log output, it seems the device disables the
> > wireless connection after a few minutes while the phone's sleeping, to
> > save resources I suppose. So I'll just have to code around that, and
> > reset the alarm to try again until the connection is back.
>
> > On Feb 5, 1:29 pm, Kostya Vasilyev<kmans...@gmail.com>  wrote:
> >> Neil,
>
> >> That's pretty much how I test too, except my code lacks a check for
> >> isConnected, only for null.
>
> >> This is what I get in my app's log:
>
> >> NetworkInfo: type: MOBILE[EDGE], state: CONNECTED/CONNECTED, reason:
> >> apnSwitched, extra: internet.mts.ru, roaming: false, failover: false,
> >> isAvailable: true
>
> >> Two ideas:
>
> >> - Check your phone settings, perhaps yours has some kind of sleep policy
> >> for mobile data;
>
> >> - Log the value you get by calling getActiveNetworkInfo into a file, and
> >> examine later.
>
> >> -- Kostya
>
> >> 05.02.2011 16:20, Neilz пишет:
>
> >>> Hi Kostya.
> >>> Yes, the alarm gets called... it's just my own call which stops it
> >>> doing it's task. For example:
> >>> if(isNetworkAvailable(mContext)){
> >>>      // do stuff...
> >>> }
> >>> public static boolean isNetworkAvailable(Context context) {
> >>>             ConnectivityManager connMgr = (ConnectivityManager)
> >>> context.getSystemService(Context.CONNECTIVITY_SERVICE);
> >>>             NetworkInfo info = connMgr.getActiveNetworkInfo();
> >>>             return(info != null&&    info.isConnected());
> >>>     }
> >>> So this call tells me the network isn't available when the phone's
> >>> asleep. I guess I'll have to try another way of testing for the
> >>> network?
> >>> On Feb 5, 1:07 pm, Kostya Vasilyev<kmans...@gmail.com>    wrote:
> >>>> 05.02.2011 15:40, Neilz пишет:
> >>>>> Ok, one problem with this alarm service.
> >>>>> I schedule it for some time in the morning, and when I get up and
> >>>>> check the phone, the alarm didn't get called, because it thinks
> >>>>> there's no network connection.
> >>>> I'm sure the alarm did get called, as the AlarmManager service has
> >>>> nothing to do with networking.
> >>>>> This is a call I make deliberately (I always check there's a
> >>>>> connection before making the server request)... but why does it think
> >>>>> there's no network when the phone is 'sleeping'? The connection is
> >>>>> still there...
> >>>> Depends on what kind of network connectivity you expect.
> >>>> In my tests (Moto Milestone), WiFi doesn't get enabled when the phone is
> >>>> woken by an alarm, but the cellular data connection is available
> >>>> immediately.
> >>>> --
> >>>> Kostya Vasilyev -- WiFi Manager + pretty widget 
> >>>> --http://kmansoft.wordpress.com
> >> --
> >> Kostya Vasilyev -- WiFi Manager + pretty widget 
> >> --http://kmansoft.wordpress.com
>
> --
> Kostya Vasilyev -- WiFi Manager + pretty widget 
> --http://kmansoft.wordpress.com

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