iOS Control Screensaver doesn't work

iOS Control Screensaver doesn’t work in 4.20.2. Trying to turn off Control Screensaver on stat of the game but the screen still disables on iOS devices. On android it works perfectly and it worked with prev UE4 versions.

Hello,

We’ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

https://epicsupport.force.com/unrealengine/s/

Thanks

I have the same Problem now. Do anybody know a workaround or any other way to prevent sleep and lock through code or bp in application?

I have the same Problem now

Good Morning,
for IOS I found a Solution last week, but I made a few Tests to give you all an answer to work with.

The Main Problem with the Screensaver Node ist, that you shoud’nt use it in BeginPlay() or Init methods.

My Solution is the set an event timer and execute it after 1 second. Than the “idleTimerDisable” bool ist stable set:

255223-screensaver.jpg

The other Solution is to use the Setter in an UFUNCTION and execute in after the APP has started completly, therefore you have to use Objective-C in your cpp code:

In .h file or start of youre .cpp you have to include / import in IOS Platform definition:

#include "Engine.h" //Needed to use GEngine DebugMessage
#if PLATFORM_IOS

#import <UIKit/UIKit.h>
#include "IOS/IOSAppDelegate.h"

#endif

And as UFunction in the cpp I use:

void AARLearnPlatformGameModeBase::Wakeup() {
#if PLATFORM_IOS
//Debug Message to Screen before and after the value was changed
//Prints the value of idleTimerDisabled as in -> 0 = Not Disabled, 1 = Is Disabled
	if (GEngine)
		GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Green, FString::Printf(TEXT("AppDel 1 %d"),  [UIApplication sharedApplication].idleTimerDisabled));
//Setter for idleTImerDisabled
	[[UIApplication sharedApplication] setIdleTimerDisabled : YES];
//Second Debug
	if (GEngine)
		GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Green, FString::Printf(TEXT("AppDel 2 %d"), [UIApplication sharedApplication].idleTimerDisabled));
#endif 
}

These are the ways I made it work properly, in my App its not neccesary to reanable the screensaver again, but if you need it, dont forget it :wink:

Greetings

same problem on iphonex when using ue4.20.1.
I set "FPlatformApplicationMisc::ControlScreensaver(FGenericPlatformApplicationMisc::EScreenSaverAction::Disable); " in initial login game mode BeginPlay() but it not worked in iphonex ios 11.4.1. The iphone screen go to sleep and locked.
Androis not comfired.

albrecht.k’s answer works. FPlatformApplicationMisc::ControlScreensaver not work in BeginPlay() but worked when call it delay several second. There are many functions not worked in BeginPlay() which i have met.

This one worked for me. I added a 1 sec delay onto the end of my pawn beginplay event, which seems to get around the problem. I had control screensaver sitting in my game mode init previously.