简体   繁体   中英

C# uwp application prevent idle mode

Windows Phone 8 had the ability for your app to prevent the phone from going to the lock screen : PhoneApplicationService.Current.ApplicationIdleMode = IdleDetectionMode.Disabled ;

Anybody know what the equivalent is for Universal Window Platform?

You can use this:

var displayRequest = new Windows.System.Display.DisplayRequest();
displayRequest.RequestActive();

But be aware of the fact that you are just requesting the screen to stay active. This can not prevent the user from locking the screen by himself manually.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM