title: android Power Management, Sleep mode, etc
body: <p>I have difficulty in understanding power management best practices and sleep mode state of android device.</p>
  
  <ol>
  <li><p>Sleep mode.</p>
  
  <p>1.1) when will this happen?</p>
  
  <p>1.2) CPU is going to sleep and my threads are suspend? and when will this happen?</p>
  
  <p>1.3) To prevent CPU sleeping I can use PARTIAL_WAKE wake lock or alarm manager? What the best for battery?</p>
  
  <p>1.4) How prevent shutdown of WiFi and 3G connection in sleep mode programmatically from my app?</p></li>
  </ol>
  
  <p>P.S Yes, I understand that it is bad for battery lifetime! I try to find best compromise...</p>
  
  <ol>
  <li><p>I write my instant messenger application. I need have persistent connection to server. How the best way to achieve this? 
  After ~20-30 minute with screen off I lost internet connection but Skype stays online. How they do it?</p></li>
  <li><p>I know about C2DM framework. But it is unidirectional from server to application. How the best way to use it for me? Server must know that client really connected!</p></li>
  </ol>