Control ScreenSaver mess with render

i needed to privent the screen from going to sleep , so i used "Control ScreenSaver " node in GmaeMode blueprint
and it causes the wrong rendering

so in order to avoid that i used a delay of 0.8s (anything below 0.6s won’t work for me at least) which fix the issue of miss rendering but it will make the screen to make a black interruption like a flick (if those are the right terminologies) in another word the screen goes full black for something like 0.2s then the render is ok.

i only tested that with Android 5.1.1 (one plus one)
UE4 4.9.2 lunch version
total blueprint project

the differences:

bad render only happens one as the the node being called

go back to normal as i reload the level

Hello sarkawt909,

Can you post a screenshot of how you have your blueprint set up where you are calling the “Control ScreenSaver?”

From your description I believe what you are trying to do is prevent the phone from going to sleep mode if you leave it alone and keep the game and phone active while in game.

Let me know if this is right or if what you are trying to achieve is different from this.

yes i want to keep the android phone from going to sleep,
as i am only use tilt for controlling and the user will not need to touch the screen frequently so i need the screen be on at least during game play inside level.

i have two game mode one for playing and one for main menu,
that’s why i decided to use the node inside the game mode, i tried with both construct and at begin play, both with the same problem …

it seem that if you call the “control screensaver” during level load, it will cause the render of the level to be interrupted. (that’a my opinion, i might be wrong)

so finally i used a delay of 0.8s so the call for “control screen save” will be after level load, but it came with a price of black blink .lol

i thought that may be because of my deivce (one plus one), but we tried on HTC it was the same.

You need to edit GameActivity.java file. It’s located in “Unreal Engine\4.9\Engine\Build\Android\Java\src\com\epicgames\ue4” and add this line AndroidThunkJava_KeepScreenOn(true); after “nativeResumeMainInit();”

This should keep the android screen on while the game is running.

thanks Bailey

that was what i was looking for now there is no need for using “Control ScreenSaver” node,

but as far as i understand the AndroidThunkJava_KeepScreenOn(true); will be applied for any other project that i may have , it is perfect

thanks again.

achieving the same thing on IOS too, would be amazing

Oh my… i just noticed that the notepad file is turned into a .java.template file and was not working because of that possibly. so beware of that if you change the java file, you have to rename it .java but now im not totally sure what it needs to be called… i changed it back to .java and it couldn’t find it so .template it is, and my game still wont stay open :frowning: