Plugin.Maui.Spine.BackgroundTasks 0.1.15

dotnet add package Plugin.Maui.Spine.BackgroundTasks --version 0.1.15
                    
NuGet\Install-Package Plugin.Maui.Spine.BackgroundTasks -Version 0.1.15
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Plugin.Maui.Spine.BackgroundTasks" Version="0.1.15" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Plugin.Maui.Spine.BackgroundTasks" Version="0.1.15" />
                    
Directory.Packages.props
<PackageReference Include="Plugin.Maui.Spine.BackgroundTasks" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Plugin.Maui.Spine.BackgroundTasks --version 0.1.15
                    
#r "nuget: Plugin.Maui.Spine.BackgroundTasks, 0.1.15"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Plugin.Maui.Spine.BackgroundTasks@0.1.15
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Plugin.Maui.Spine.BackgroundTasks&version=0.1.15
                    
Install as a Cake Addin
#tool nuget:?package=Plugin.Maui.Spine.BackgroundTasks&version=0.1.15
                    
Install as a Cake Tool

Plugin.Maui.Spine.BackgroundTasks

Background tasks for .NET MAUI: a class with [BackgroundTask] is found at startup, like a Spine page or widget, and run by the platform's scheduler while the app is not on screen. That is BGTaskScheduler on iOS and JobScheduler on Android. On Windows and Mac Catalyst a timer runs the tasks while the app is open. After a run, the widgets the task names are rebuilt, so a home-screen widget stays fresh without the app being opened.

dotnet add package Plugin.Maui.Spine.BackgroundTasks
builder.UseSpine(options => options.AddAssembly(typeof(MauiProgram).Assembly));   // registers BackgroundTasks too
// builder.UseSpineBackgroundTasks(o => o.Interval("standings", TimeSpan.FromHours(1)));   // only to change the options
[BackgroundTask("standings", IntervalMinutes = 30, RequiresNetwork = true, Widgets = ["team"])]
public sealed class StandingsTask(IStandingsApi api, StandingsStore store) : IBackgroundTask
{
    public async Task RunAsync(BackgroundTaskRun run, CancellationToken cancellationToken) =>
        await store.SaveAsync(await api.FetchAsync(cancellationToken), cancellationToken);
}

await tasks.RequestAsync("standings");            // IBackgroundTasks: run it now
var status = tasks.StatusOf("standings");         // last run, outcome, error, next due

The platform decides when a scheduled task runs. iOS runs it when it chooses, never on a clock, and not after the user swipes the app away. Android runs it at most every 15 minutes. Windows and Mac Catalyst run it only while the app runs (IBackgroundTasks.RunsWhileClosed is false there).

On iOS the build adds UIBackgroundModes: fetch and one task identifier, <ApplicationId>.spine.refresh, to Info.plist. Spine runs every task under that one identifier, because iOS allows one pending refresh request per app. With Plugin.Maui.Spine.Widgets in the app, the widgets' background refresh runs as the built-in task spine.widgets.

Documentation

Product Compatible and additional computed target framework versions.
.NET net10.0-android36.0 is compatible.  net10.0-ios26.0 is compatible.  net10.0-maccatalyst26.0 is compatible.  net10.0-windows10.0.19041 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.15 42 10/16/2026
0.1.14 96 10/9/2026
0.1.13 83 10/8/2026