Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of how to use Background Services in Xamarin.Forms applications. -
using System;
using System.Threading.Tasks;
using Matcha.BackgroundService;
namespace DemoBackground.Services
public class BackgroundService : IPeriodicTask
public TimeSpan Interval { get; set; }
public BackgroundService(int seconds)
Interval = TimeSpan.FromSeconds(seconds);
public async Task<bool> StartJob()
Console.WriteLine(DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss"));
//Return true para continuar
return true;
//Return false para parar
//return false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.