views:

49

answers:

2

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 lock screen and handling the events for all the hardware buttons including the windows/home button?

Any suggestions will be appreciated.

A: 

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

I believe setting:

PhoneApplicationService.Current.ApplicationIdleMode = IdleDetectionMode.Disabled

will enable the application to run under a lock screen.

Cheers.

Tom
Be sure to get user permission for running under the lock screen (the first time you do so) 0 it's a marketplace requirement. Also be aware that you'll need to reset this value each time the app runs as the setting does not persist across executions of an app.
Matt Lacey
A: 

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

tiwahu