public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId) { Monitor = new NetworkStatusMonitor(this); Monitor.NetworkStatusChanged += Monitor_NetworkStatusChanged; Monitor.Start(); new Task(async() => await DoWork()).Start(); return(StartCommandResult.Sticky); }
public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId) { monitor = new NetworkStatusMonitor(this); monitor.NetworkStatusChanged += Monitor_NetworkStatusChanged; monitor.Start(); elTimer = new System.Timers.Timer(5000); elTimer.Elapsed += ElTimer_Elapsed; elTimer.AutoReset = true; elTimer.Enabled = true; Started = true; Kill = false; //new Task(async () => await DoWork()).Start(); return(StartCommandResult.Sticky); }