문제

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?

도움이 되었습니까?

해결책 2

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.

다른 팁

Code for copy-paste :)

Windows.System.Display.DisplayRequest KeepScreenOnRequest = new Windows.System.Display.DisplayRequest();

KeepScreenOnRequest.RequestActive();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top