views:

117

answers:

1

I have an android service that connects to remote server by TCP/IP and waits for notifications from it. Should I care about PowerManagement? Can sleep mode affect me some how?

If no, than what are the "use cases" to care about wake locks?

+3  A: 

Warning: the following is educated guesswork. Your kilometerage may vary.

My understanding is that packets arriving on an open socket connection will wake up the device. However, there is no guarantee on how long the device will remain awake. It can't keep the device awake indefinitely -- otherwise, Google's new Cloud-to-Device Messaging (C2DM) stuff would keep the device on all the time.

My guess is that it just wakes up the device, but then it is up to you to make sure that it stays awake as long as you need it to be awake. For that, you will need a WakeLock.

Conversely, what you do not want to do is set up your server channel such that there is a steady stream of data all the time. This will hammer the user's battery, not only by keeping the CPU on, but just for the radio -- for 3G, having a data connection is not expensive, but sending/receiving data is.

When it appears, watch the Google I|O 2010 presentation on C2DM. They covered a number of the power implications of Android and how they had to address them for the C2DM client portion.

CommonsWare