# How can I avoid sleep mode in android?

**URL:** <https://forums.unrealengine.com/t/how-can-i-avoid-sleep-mode-in-android/320766>\
**Category:** Blueprint\
**Tags:** how-do-i, unreal-engine, Android, UE4, question, Blueprint\
**Created:** [June 5, 2015, 4:50am UTC](https://forums.unrealengine.com/t/how-can-i-avoid-sleep-mode-in-android/320766 "2015-06-05T04:50:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![CX25\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CX25\_1](https://forums.unrealengine.com/u/CX25_1)\
**Post date:** [June 5, 2015, 4:50am UTC](https://forums.unrealengine.com/t/how-can-i-avoid-sleep-mode-in-android/320766/1 "2015-06-05T04:50:46Z")

</div>

How can i set the screen on while my game is launching on an Android device with blueprints??

---

<div class="post-metadata">

**Author:** ![mhnoni](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mhnoni](https://forums.unrealengine.com/u/mhnoni)\
**Post date:** [February 8, 2016, 9:21am UTC](https://forums.unrealengine.com/t/how-can-i-avoid-sleep-mode-in-android/320766/2 "2016-02-08T09:21:25Z")

</div>

i was just going to create new post asking the same thing , how to prevent android device to go to sleep during startup loading ?

So any help pls ?

thanks  
MH

---

<div class="post-metadata">

**Author:** ![slarti](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@slarti](https://forums.unrealengine.com/u/slarti)\
**Post date:** [February 8, 2016, 10:59am UTC](https://forums.unrealengine.com/t/how-can-i-avoid-sleep-mode-in-android/320766/3 "2016-02-08T10:59:07Z")

</div>

The only action that I could find is the “Control Screensaver” Blueprint Action, this should enable/disable the keep-screen-on functionality on android. Not totally sure if keep-screen-on also disables sleep but I think so.

The code delegates to a platform specific action. On android the following is called:

```
AndroidThunkCpp_KeepScreenOn(true);

```

You can see that for yourself if you right click on the Control Screensaver node and use “Goto Code Definition”. Follow the source until you land in the AndroidMisc.cpp file. There, find the method `FAndroidMisc::ControlScreensaver`.

I don’t know if its is possible to modify the first loading of the game in any way by blueprint. You could change the source to call the ControlScreensaver/KeepScreenOn method on the first possible occasion.

---

<div class="post-metadata">

**Author:** ![mhnoni](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mhnoni](https://forums.unrealengine.com/u/mhnoni)\
**Post date:** [February 10, 2016, 5:48pm UTC](https://forums.unrealengine.com/t/how-can-i-avoid-sleep-mode-in-android/320766/4 "2016-02-10T17:48:14Z")

</div>

Thanks its good but as you said seems we need to call this action during loading which is before event begin play ,and I’m not a programer so i can’t get more that what you got , hope UE team can add this as a feature in the engine in the future .

---

<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:52am UTC](https://forums.unrealengine.com/t/how-can-i-avoid-sleep-mode-in-android/320766/5 "2016-08-03T08:52:19Z")

</div>

I’m calling the “Control Screensaver” Blueprint Action from a “Event Construct”, in a Widget, and it works fine. Screen doesn’t turn off.

---

<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:** [December 1, 2018, 4:43am UTC](https://forums.unrealengine.com/t/how-can-i-avoid-sleep-mode-in-android/320766/6 "2018-12-01T04:43:02Z")

</div>

having this same problem. ive tried many many things and no good… im trying to do the “event construct” on a widget now, this is my only hope… ill let you know.

my answer hub is  
[https://answers.unrealengine.com/questions/853542/android-going-to-sleepscreensaver-despite-interfer.html](https://answers.unrealengine.com/questions/853542/android-going-to-sleepscreensaver-despite-interfer.html)
