How do I keep the device from fading out the screen? (DEF-1260) (SOLVED)

I don’t want the screen to fade out after a few seconds - how do I make sure that it stays lit/active?

How and where do the screen fade out? Are you talking about overriding device user settings?

While the game is running, the screen fades out after a while, as per the power-saving settings. Apps can override this, but I don’t know how to do it in Defold. I’m not getting this on iOS it seems, but it happens on the Android devices.

Basically looking for the Defold equivalent of this: http://docs.unity3d.com/ScriptReference/Screen-sleepTimeout.html

Ok. I’m not sure if it perhaps can be set in the manifest. I’ll check.

1 Like

I’m resurrecting this one since it was asked about again in another post. @sicher, did you find a solution?

This feature has been requested before, the internal ID is DEF-1260. It’s planned to be implemented during the summer.

1 Like

Is there new info on this? How to keep an app awake?
It has some trivial Java implementation on android, I bet whether it was added. Couldn’t find any toggles in project settings or in the documentation.
Tried searching for “keep awake” with no luck

Have you tried setting the window dim mode?

4 Likes

Thanks, looks like the exact thing I was looking for.

2 Likes

Hello again from 2018,

I am not sure where I need to put this code

  • window.DIMMING_ON

in order to not stop the device from going to sleep when the game is running. Does it just go in the init section of a script in the bootstrap collection? In the format “window.DIMMING_ON = true” ?

If you want turn off dimming (device do not turn off the screen), you have to use:

window.set_dim_mode(window.DIMMING_OFF)

When you need to back possability of device dimming (for example in pause window), you have to use:

window.set_dim_mode (window.DIMMING_ON)

4 Likes

Thanks AGulev. Your advice is always useful.

2 Likes