title: How to wake up device when it sleeps
body: <p>I've already read a lot about this topic on SO.
  I'm trying to write SIP Client, which of course should accept incoming calls when the device is sleeping.
  The first thing I've tried was to use these flags in my <code>onCreate</code> method:</p>
  
  <pre><code>Window window = this.getWindow();
  window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
  window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
  window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
  window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  </code></pre>
  
  <p>And my devices (different models of phones and different API Levels) woke up <strong>only when they were plugged in</strong> to PC <strong>with USB cable</strong> or were in charging process. <br/> When phones were unplugged there were no impact of flags. Then I found that one guy has already asked a similar question on SO: <a href="https://stackoverflow.com/questions/14741612/android-wake-up-and-unlock-device">Android - Wake Up and Unlock Device</a> Nobody replied to him and after some time he had found answer on his question and posted it. The answer was to use <strong>PowerManager</strong> class. His answer helped me a lot, but documentation of PowerManager says <em>"Device battery life will be significantly affected by the use of this API"</em>. I felt it on myself. My application began to use too much energy of battery. I compared my app with WhatsApp and saw gigantic difference in battery energy using.<br/>
  So, is there any other way to wake up device when it sleeps or <br/>
  does anybody know how this process works in WhatsApp, Skype and other apps which receives incoming calls and saves battery life?</p>