ScheduledActionService.LaunchForTest Method

May 11, 2014

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 static void LaunchForTest(
	string name,
	TimeSpan delay
)

Parameters

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.

ExceptionCondition
InvalidOperationException

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

The ExpirationTime for the ScheduledTask has already passed.

NotSupportedException

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.

Caution noteCaution:

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.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

Show:
© 2014 Microsoft