Fighting the Lock Screen in Windows Phone 7 by disabling IdleDetectionMode

One of the things you may experience with your Windows Phone application is that it will get suspended when the lock screen is displayed. As the lock screen appears after a relatively short period of time this can be particularly frustrating if you have to synchronize a large quantity of data, or you have created a game that only requires the accelerometer (no user input on the screen can result in the application appearing to be idle). To get around this you can disable idle detection by setting one of two properties.

Microsoft.Phone.Shell.PhoneApplicationService.Current.ApplicationIdleDetectionMode

Or

Microsoft.Phone.Shell.PhoneApplicationService.Current.UserIdleDetectionMode

Essentially setting the UserIdleDetectionMode to disabled will prevent the lock screen automatically appearing, whilst setting ApplicationIdleDetectionMode to disabled will allow the application to continue to operate whilst the lock screen is active. Note that there is a clause in the application certification requirements that stipulate the conditions with which you must comply when setting these properties.

Leave a comment