Exemplo n.º 1
0
        public override StartCommandResult OnStartCommand(Intent intent, [GeneratedEnum] StartCommandFlags flags, int startId)
        {
            _cts = new CancellationTokenSource();

            Task.Run(() =>
            {
                try
                {
                    var servicer = new GetService();
                    servicer.RunService(_cts.Token).Wait();
                }
                catch (System.OperationCanceledException) {
                }
            }, _cts.Token);

            return(StartCommandResult.Sticky);
        }