How do I force the screen not to go black/sleep (timeout)

0 favourites
  • 4 posts
From the Asset Store
Build a thrilling space station scenario with these level assets and characters.
  • When the screen hasn't been touched for some time it goes black/into sleep mode. The time it takes depends on the settings in the phone. Called Screen timeout (I guess, my phone is not in english though)

    Can that be controlled by an app? the timeout period is a timeframe from last time you touched the screen.

    But I am playing with a game that you controll with the gyro. you do not have to tap the screen. But then the phone always go black after 30sec since you do not touch the screen... Possible to force it to be awake while in a certain app?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Kyatric or Ashley , is this possible in Construct2 right now. To prohibit the screen from sleep mode? (Maybe I just missed the functionality)

    Otherwise, possible to implement the function into a standard action? Or is this to be set in the XDK somehow?

    From Android developer I know there is a flag called FLAG_KEEP_SCREEN_ON

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    to disable the screen timeout and
    
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    to re-enable it.[/code:16lr9z3b]
    
    Explained in detail here:
    [url=https://developer.android.com/training/scheduling/wakelock.html]https://developer.android.com/training/ ... elock.html[/url]
  • Already answered in this 2 years old topic : https://www.scirra.com/forum/keeping-mobile-app-awake-prevent-screenlock_t163137

    You have to add a Cordova plugin to the Intel XDK project.

    Latest/working plugin link is in the third page. Nevertheless, read the whole topic, it can be useful.

  • Sorry, didn't find that topic before.

    Thank you!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)