# Android Keep Screen On

**URL:** <https://forums.unrealengine.com/t/android-keep-screen-on/299941>\
**Category:** Mobile\
**Tags:** android-device, unreal-engine, question\
**Created:** [November 26, 2014, 7:00pm UTC](https://forums.unrealengine.com/t/android-keep-screen-on/299941 "2014-11-26T19:00:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rennsix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rennsix](https://forums.unrealengine.com/u/rennsix)\
**Post date:** [November 26, 2014, 7:00pm UTC](https://forums.unrealengine.com/t/android-keep-screen-on/299941/1 "2014-11-26T19:00:36Z")

</div>

My project is mostly comprised of matinees. My device “Display” is set to turn off after 15 seconds of inactivity.

The problem I have is that even though my matinee is playing the screen turns off after 15sec even though there is activity on the screen…

Is there a way to include a command in the android build which tells the device to keep the screen on while the application is running?

For now, I’ve downloaded the “Keep Screen On” app from the Google Play store and set my app to stay on but that’s not exactly what I want to force people to do to use my app.

Any advice or insight would be great

Thanks

---

<div class="post-metadata">

**Author:** ![ThePassenger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ThePassenger](https://forums.unrealengine.com/u/ThePassenger)\
**Post date:** [December 2, 2014, 7:14pm UTC](https://forums.unrealengine.com/t/android-keep-screen-on/299941/2 "2014-12-02T19:14:25Z")

</div>

Hi. I managed to get the screen working. You need to edit GameActivity.java file. It’s located in “Unreal Engine\4.5\Engine\Build\Android\Java\src\com\epicgames\ue4” and add this line AndroidThunkJava\_KeepScreenOn(true); after “nativeResumeMainInit();”

---

<div class="post-metadata">

**Author:** ![rennsix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rennsix](https://forums.unrealengine.com/u/rennsix)\
**Post date:** [December 3, 2014, 12:36am UTC](https://forums.unrealengine.com/t/android-keep-screen-on/299941/3 "2014-12-03T00:36:40Z")

</div>

I’ll give it a go. Thanks!

---

<div class="post-metadata">

**Author:** ![rennsix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rennsix](https://forums.unrealengine.com/u/rennsix)\
**Post date:** [December 3, 2014, 3:25pm UTC](https://forums.unrealengine.com/t/android-keep-screen-on/299941/4 "2014-12-03T15:25:37Z")

</div>

Works great!!! Thanks again.

---

<div class="post-metadata">

**Author:** ![mindseed](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mindseed/32/490022_2.png) [@mindseed](https://forums.unrealengine.com/u/mindseed)\
**Post date:** [May 23, 2016, 3:19pm UTC](https://forums.unrealengine.com/t/android-keep-screen-on/299941/5 "2016-05-23T15:19:52Z")

</div>

Hi, is this still a valid method? I get an unknown error after packaging which disappears after I’ve removed this bit of code from the java file.  
Thanks.

---

<div class="post-metadata">

**Author:** ![ThePassenger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ThePassenger](https://forums.unrealengine.com/u/ThePassenger)\
**Post date:** [May 23, 2016, 5:35pm UTC](https://forums.unrealengine.com/t/android-keep-screen-on/299941/6 "2016-05-23T17:35:49Z")

</div>

Hi, idk, probably not.

---

<div class="post-metadata">

**Author:** ![RVillani](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rvillani/32/1194572_2.png) [@RVillani](https://forums.unrealengine.com/u/RVillani)\
**Post date:** [August 3, 2016, 8:46am UTC](https://forums.unrealengine.com/t/android-keep-screen-on/299941/7 "2016-08-03T08:46:52Z")

</div>

From Chris Babcock on the [forums](https://forums.unrealengine.com/showthread.php?65450-Prevent-phone-from-entering-sleep-mode):

In Blueprint there is a “Control Screensaver” node. Add this with “Allow Screen Saver” checkbox off.  
From code, use FPlatformMisc::ControlScreensaver(FPlatformMisc::EScreenSaverAction:isable).

Although there’s a comment there stating that it kills MoviePlayback on Android, I haven’t experienced problems (aside from seeking always jumping to 0 seconds, but that was already happening before).

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7938dc8e1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7938dc8e1](https://forums.unrealengine.com/u/anonymous_user_7938dc8e1)\
**Post date:** [November 30, 2018, 5:32am UTC](https://forums.unrealengine.com/t/android-keep-screen-on/299941/8 "2018-11-30T05:32:23Z")

</div>

tried all of these and none work. phone going to sleep still. ive tried blueprint in game mode, in construct, begin play, everywhere. ive also tried adding the code AndroidThunkJava\_KeepScreenOn(true);  
i think ive put it in right place because it still compiles but maybe not… this holding me up major

---

<div class="post-metadata">

**Author:** ![Naitguolf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Naitguolf](https://forums.unrealengine.com/u/Naitguolf)\
**Post date:** [March 3, 2022, 11:45am UTC](https://forums.unrealengine.com/t/android-keep-screen-on/299941/9 "2022-03-03T11:45:10Z")

</div>

bump. Did anyone had success with this? Sadly using this node does not work nor iOS, or Android:

> **[Control Screensaver](https://docs.unrealengine.com/4.26/en-US/BlueprintAPI/Utilities/Platform/ControlScreensaver/)**
>
> Control Screensaver

---

<div class="post-metadata">

**Author:** ![Trisutrisno](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/trisutrisno/32/473775_2.png) [@Trisutrisno](https://forums.unrealengine.com/u/Trisutrisno)\
**Post date:** [December 27, 2023, 2:14am UTC](https://forums.unrealengine.com/t/android-keep-screen-on/299941/10 "2023-12-27T02:14:50Z")

</div>

Yes this works. I use the node Control Screensaver Allow Screensaver to false, and now my screen keeps on. I put it in my character BP in begin play, so in main menu screen can off, but in gameplay where the character is used, it will not
