We have two properties to consider:
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.