ScheduledActionService.LaunchForTest Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Causes the background agent associated with a ScheduledTask to be run in the background after the specified delay.

Namespace:  Microsoft.Phone.Scheduler
Assembly:  Microsoft.Phone (in Microsoft.Phone.dll)


Public Shared Sub LaunchForTest ( _
    name As String, _
    delay As TimeSpan _
public static void LaunchForTest(
    string name,
    TimeSpan delay


  • name
    Type: System..::.String
    The name that uniquely identifies the ScheduledTask object.
  • delay
    Type: System..::.TimeSpan
    The delay after which the associated background agent should be run.


Exception Condition

A ScheduledTask with the specified name is not registered with the Scheduled Action Service.

The ExpirationTime for the ScheduledTask has already passed.


The supplied object is not a ScheduledTask object.


Use this method during application development to test your background agent implementation. Background agents are launched by the operating system according to the type of agent and the current state of the system. This scheduling logic is described in Background agents for Windows Phone 8. You can use this method to launch an agent more frequently from your foreground application or from the agent itself in order to test the agent execution. This method should only be used during development. You should remove calls to this method from your production application.


You should set the delay value to at least 60 seconds to ensure that the background agent will be launched. Delay times less than 60 seconds may result in the background agent not being launched.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1


Windows Phone

See Also


ScheduledActionService Class

Microsoft.Phone.Scheduler Namespace