Search code examples
uwpbackground-task

Unregister uwp background task


I register a background task and I try to unregister it again when a certain setting is deactivated. But I only found information about register and scheduling tasks. Is there no way to this?


Solution

  • is this what you are looking for?

    var tasks = BackgroundTaskRegistration.AllTasks;
                foreach(var task in tasks)
                {
                    // You can check here for the name
                    string name = task.Value.Name;
    
                    task.Value.Unregister(true);
                }