I'd like to disable screen saver while my appliction is running. How it can be done? Where is the best place to disable / enable the screen saver? in the first activity? in the application.java?
Go to settings, then display, then scroll up to screen saver and tap it and select the option which says none. Hope this helped!
Expand Control Panel, and then click Display. In the right pane, double-click Password protect the screen saver. Select Disable on the Policy tab.
Turning on the screensaver is very simple. Open up Settings then tap on Display. Scroll down through the menu until you find Screensaver or Daydream (depending on which version of Android you're currently running). Tap on the button to the right of the name and this will enable the feature.
The wake lock permission must be specified in the manifest.
<uses-permission android:name="android.permission.WAKE_LOCK" />
Then in the activity use the following to keep the screen on while the activity is running.
getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
Remember that unnecessarily keeping the screen on unnecessarily drains power from the user's device.
You must also add:
import android.view.WindowManager.LayoutParams;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With