Tuesday, December 4, 2012

[android-developers] Re: Wake locks android

Hi, I m doing it as part of a research project. I need my service to keep running even when the device is asleep(until the user presses Stop button in the App s GUI) and monitor difference in battery consumption. I used PowerManager(implemented WiFi Locks also) because I read that CPU will be ON during this period. When I plug device to the computer, it is working fine. But as soon as it is disconnected, the service seem to stop. I want to know if this is expected behavior? Please guide me in this regard.

On Tuesday, December 4, 2012 9:08:02 PM UTC+2, G. Blake Meike wrote:
You probably realize that just seizing a WakeLock for a long time is a really, really horrible idea, yes?  Given that, it isn't clear what you are actually trying to do.  Obviously, your service can't run when the device is asleep....

You can use the Alarm Manager in RTC_WAKEUP mode, to cause the device to be awakened, periodically, to run your service.  If you do that, you may have to seize a WakeLock to keep the device awake until your service has completed its task and is ready to let the device go back to sleep...

G. Blake Meike
Marakana

Programming Android 2ed is now in stores:

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate