Mango Sample: Lock and Run
When a user is idle, their screen locks and your Windows Phone application is suspended. This might be undesired, like for: a timer, certain games, and driving directions.
We have two properties to consider:
- The UserIdleDetectionMode property
- The ApplicationIdleDetectionMode property
Read this from MSDN: For the best user experience in applications that target Windows Phone OS 7.1, Microsoft strongly recommends that you utilize the following new features while your application runs under lock, instead of setting theApplicationIdleDetectionMode property:
Fast Application Switching, a built-in feature of the OS that provides substantial improvements to state maintenance and performance when an application moves to and from the background.
Background agent features, as described in Multitasking for Windows Phone, for scenarios such as background transfers and background audio playback.
Option 1: UserIdleDetectionMode
This property allows your application to continue running when the user is not physically interacting with the phone. Default = IdleDetectionMode.Enabled. The operating system considers the user to be idle when they have not touched the screen or the hardware buttons within the device lock timeout window, specified in the device’s Settings page.