Do anyone know, how to prevent the lockscreen in a Windows (Phone) 8.1 Universal App?
In Windows Phone 8, I have used:
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
Has anyone an idea?
Code for copy-paste :)
Windows.System.Display.DisplayRequest KeepScreenOnRequest = new Windows.System.Display.DisplayRequest();
KeepScreenOnRequest.RequestActive();
You may have a look at this question at MSDN, which points to this answer on SO. In short while using WinRT you can use DisplayRequest class:
Apps that show video or run for extended periods without user input can request that the display remain on by calling DisplayRequest::RequestActive. When a display request is activated, the device's display remains on while the app is visible. When the user moves the app out of the foreground, the system deactivates the app's display requests and reactivates them when the app returns to the foreground.
There is an example at MSDN, also remember to follow guidelines and release DisplayRequests
when they are no longer needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With