开发者

Is it possible to programmatically lock a windows phone 7 device?

开发者 https://www.devze.com 2023-01-23 05:24 出处:网络
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.

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.

Is this possible?

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.

Any ideas if this is possible? Either somehow locking the phone without tombstoning the app, or implementing a sort of custom开发者_如何学C lock screen and handling the events for all the hardware buttons including the windows/home button?

Any suggestions will be appreciated.


Just as you figured out:

PhoneApplicationService.Current.ApplicationIdleMode = IdleDetectionMode.Disabled

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


I think I've done it again - asking questions too soon.

I believe the following setting:

PhoneApplicationService.Current.ApplicationIdleMode = IdleDetectionMode.Disabled

will enable the application to run under a lock screen.

0

精彩评论

暂无评论...
验证码 换一张
取 消