如何在 Windows (Phone) 8.1 通用应用程序中防止锁屏? [英] How to prevent lockscreen in a Windows (Phone) 8.1 Universal App?

查看:33
本文介绍了如何在 Windows (Phone) 8.1 通用应用程序中防止锁屏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何防止 Windows (Phone) 8.1 通用应用程序中的锁屏?

Do anyone know, how to prevent the lockscreen in a Windows (Phone) 8.1 Universal App?

在 Windows Phone 8 中,我使用过:

In Windows Phone 8, I have used:

PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;

有人有想法吗?

推荐答案

你可以看看 在 MSDN 上的这个问题,指向 SO 上的这个答案.总之,在使用 WinRT 时,您可以使用 DisplayRequest 类:

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:

在没有用户输入的情况下显示视频或长时间运行的应用可以通过调用 DisplayRequest::RequestActive 请求保持显示.当显示请求被激活时,设备的显示屏会在应用程序可见时保持打开状态.当用户将应用移出前台时,系统会停用应用的显示请求,并在应用返回前台时重新激活它们.

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.

MSDN 上的示例,还请记住遵循指南并在不再需要 DisplayRequests 时释放它们.

There is an example at MSDN, also remember to follow guidelines and release DisplayRequests when they are no longer needed.

这篇关于如何在 Windows (Phone) 8.1 通用应用程序中防止锁屏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆