I want to wake up the device and play a video. Here is my code snippet to wake up and disable key guard.
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();
The video is playing but the device is not waking up.
Any suggestions?
EDITED
I have found a working solution and I have posted it as an answer.
If there are better solutions, I would like to learn and know of it.
Thank you.