是否可以以编程方式锁定 Windows Phone 7 设备? [英] Is it possible to programmatically lock a windows phone 7 device?
问题描述
我正在创建一个 WP7 应用程序,当用户不使用手机时需要继续运行 - 理想情况下,用户设置它,锁定手机并继续他们的生活.
I'm creating a WP7 app that needs to continue running when the user is not using the phone - ideally the user sets it going, locks the phone and carries on with their life.
这可能吗?
我知道可以禁用锁定屏幕,所以如果用户只是将手机放在桌子上就可以了,然后继续运行.问题是当他们把它放在口袋里时 - 按钮会被按下,比如 windows/home 按钮,如果发生这种情况,那么应用程序会立即被删除.
I know it is possible to disable the lock screen, so if the user were to just leave the phone on a table it would be fine and carry on running. The problem is when they put it in their pocket - buttons will get pressed such at the windows/home button, and if this happens then the app is tombstoned straight away.
如果可能的话,有什么想法吗?要么以某种方式锁定手机而不对应用程序进行逻辑删除,要么实现一种自定义锁定屏幕并处理所有硬件按钮(包括 Windows/主页按钮)的事件?
Any ideas if this is possible? Either somehow locking the phone without tombstoning the app, or implementing a sort of custom lock screen and handling the events for all the hardware buttons including the windows/home button?
任何建议将不胜感激.
推荐答案
正如你所想:
PhoneApplicationService.Current.ApplicationIdleMode = IdleDetectionMode.Disabled
不再需要向用户征求许可(因为原来的 6.3.1可配置功能"已被删除).但是,还有其他市场认证要求需要考虑,请参阅第 6.3 节:http://go.microsoft.com/fwlink/?LinkID=183220
No need to ask user for permission anymore (since the original 6.3.1 "Configurable Functionality" was dropped). However, there are other Marketplace certification requirements to consider, see section 6.3: http://go.microsoft.com/fwlink/?LinkID=183220
这篇关于是否可以以编程方式锁定 Windows Phone 7 设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!