On Friday, March 1, 2013 2:39:59 AM UTC-5, Amith Salian wrote:
>
> I have a strange situation with my Service in Activity.
> My service calls a background method every 20 sec when active.  In the 
> development environment the time elapse between successive calls is exactly 
> 20 sec, however in an Android device it is arbitrary.
> Anyone encountered this issue?
>
>
Real devices sleep* (shut down the application processor and only wake
up for alarms or on request by the radio processor.)  To confirm that the
sleep is the issue, plug the device into USB and check the developer
option to keep the screen on while charging and see if your calls still
happen every 20 seconds (if it's still arbitrary, you have some other
bug.)

Read up on wake locks and alarms if you need to wake it from that sleep. 

Note that battery use while awake is close to rate of use for "talk time"
(full to empty) and while asleep is close to "standby", so keeping it awake
will drain the battery much sooner.

* note that the term "sleep" is overloaded and I only use it because there
isn't a preferred term for when the processor shuts down when you don't
hold a partial wake lock (vs when the screen goes blank but the processor
still gets cycles.)  My use isn't related to any language sleep function
but intended to describe large periods of time where the application 
processor
doesn't get cycles to do things because the OS has shut things down and
no wake locks or partial wake locks are being held.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to