Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of how to use Background Services in Xamarin.Forms applications. - http://julianocustodio.com/background-services
using DemoBackground.Services;
using Matcha.BackgroundService;
using Xamarin.Forms;
namespace DemoBackground
{
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage = new Views.MainPage();
}
protected override void OnStart()
{
// Registra
BackgroundAggregatorService.Add(() => new BackgroundService(15));
// Inicia
BackgroundAggregatorService.StartBackgroundService();
}
protected override void OnSleep()
{
// Para
BackgroundAggregatorService.StopBackgroundService();
}
protected override void OnResume()
{
// Inicia Novamente
BackgroundAggregatorService.StartBackgroundService();
}
}
}
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.