title: How to wake up android device from sleep and play a video
body: <p>I want to wake up the device and play a video. 
  Here is my code snippet to wake up and disable key guard. </p>
  
  <pre><code>pm = (PowerManager) getApplicationContext().getSystemService(
      Context.POWER_SERVICE);
  keyguardManager = (KeyguardManager) getApplicationContext()
      .getSystemService(Context.KEYGUARD_SERVICE);
  KeyguardLock keyguardLock = keyguardManager.newKeyguardLock("TAG");
  wakeLock = pm.newWakeLock(
          (PowerManager.SCREEN_BRIGHT_WAKE_LOCK
              | PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP),
          "TAG");
  wakeLock.acquire();
  keyguardLock.disableKeyguard();
  playVideo(getApplicationContext());
  wakeLock.release();
  </code></pre>
  
  <p>The video is playing but the device is not waking up.</p>
  
  <p>Any suggestions?
  <br><br>
  <strong>EDITED</strong><br>
  I have found a working solution and I have posted it as an answer.<br>
  If there are better solutions, I would like to learn and know of it.<br>
  Thank you.</p>