June 22, 2011

This sample shows how to create and schedule a background agent for a Windows Phone application. The background agent enables the execution of code in the background even when the associated application is not running in the foreground. For more information about running code in the background, see Scheduled Tasks Overview for Windows Phone.

You need to install Windows Phone SDK 7.1 Beta 2 to run this sample. To get started, go to App Hub.

To run the sample

  1. Double-click BackgroundAgentSample.sln to open the solution.

  2. Press F5 to start debugging the application.

  3. Use the check boxes to enable the periodic and/or resource-intensive background agents.

    Caution:

    In the pre-release version, when debugging, the background agents are launched as soon as you register them with the service. In future releases, this behavior will change.