I have a service that launches an Activity and the screensaver is on. How can I dismiss programmatically Amazon Fire TV screensaver?
Asked
Active
Viewed 702 times
2 Answers
3
The First part dismisses the lockscreen, the second part dismisses the Screensaver. However, I don't know if this works with the Amazon Fire TV Screensaver, but you can try it.
Call this method in the onReceive or onCreate Method of your activity.
private void wakeUpTheScreen()
{
Window win = getWindow();
win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
}
I think you also need this permission but I'm not sure:
<uses-permission android:name="android.permission.WAKE_LOCK" />

Erythrozyt
- 802
- 6
- 21
-
1it doesn't work, this prevent the screensaver to show up if the app is in foreground – Duna Nov 18 '15 at 15:12
2
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

Duna
- 1,564
- 1
- 16
- 36