prevent windows 10 mobile from locking

2019-08-07 12:21发布

I have finally upgraded my windows 8 app to windows 10 app. Unfortunately some of the features are not working in windows 10. One of the features I am looking is preventing automatic lock screen while my application is running.

In windows phone 8 I am using below code to prevent auto locking of windows phone, however, in windows 10, I didn't find this feature.

PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;

What is the alternate of the above in windows 10?

Thanks!

1条回答
爷、活的狠高调
2楼-- · 2019-08-07 12:34

you might use the new DisplayRequest class

Pretty simple to use :

displayRequest = new DisplayRequest();
displayRequest.RequestActive();
//Do your always on stuff
displayRequest.RequestRelease();
查看更多
登录 后发表回答