public override void Stop() { if (intent != null) { base.Stop(); context.StopService(intent); context.UnregisterReceiver(receiver); receiver = null; intent = null; } }
public override void Start(Func <Task> action, CancellationTokenSource cts, Action <ProgressMessage> onProgressCallback = null) { if (intent == null) { base.Start(action, cts, onProgressCallback); receiver = new BackgroundingReceiver(action, TokenSource.Token); intent = new Intent(context, typeof(BackgroundingService)); context.RegisterReceiver(receiver, new IntentFilter(Constants.IntentStartKey)); context.StartService(intent); } }