How can I avoid sleep mode in android?

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

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

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.

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 .

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

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