ScheduledTaskAgent.OnInvoke Method

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

Called when the Scheduled Task is executed. Override this method and provide the code that should execute in the background.

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


Protected Friend MustOverride Sub OnInvoke ( _
    task As ScheduledTask _
protected internal abstract void OnInvoke(
    ScheduledTask task



Each application can have only one ScheduledTaskAgent associated with it. If you want to use both a PeriodicTask and a ResourceIntensiveTask for the same application, you can check the task parameter in OnInvoke to see which type of task it is and branch your code accordingly.

For more information about Scheduled Tasks, see Background agents for Windows Phone 8

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1


Windows Phone

See Also


ScheduledTaskAgent Class

Microsoft.Phone.Scheduler Namespace