سؤال

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