I have a service that launches an Activity and the screensaver is on. How can I dismiss programmatically Amazon Fire TV screensaver?
private void turnScreenOn(Activity act) {
KeyguardManager km = (KeyguardManager) act.getApplicationContext().getSystemService(Context.KEYGUARD_SERVICE);
final KeyguardManager.KeyguardLock kl = km.newKeyguardLock("MyKeyguardLock");
kl.disableKeyguard();
PowerManager powerManager = (PowerManager) act.getApplicationContext().getSystemService(Context.POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP
| PowerManager.ON_AFTER_RELEASE, "MyWakeLock");
wakeLock.acquire();
}
I called this from oncreate() and it works