public override async void OnDestroy() { _log.Info("Service is stopped."); try { IsServiceRunning = false; if (_apiClient?.IsConnected == true) { await LocationServices.FusedLocationApi.RemoveLocationUpdates(_apiClient, this); _apiClient?.Disconnect(); } _locRequest?.Dispose(); _locRequest = null; _apiClient?.Dispose(); _apiClient = null; } catch (Exception ex) { _log.Debug(ex); } base.OnDestroy(); }
public override void OnDestroy() { apiClient.Disconnect(); locRequest.Dispose(); IsStarted = false; SendBroadcast(new Intent("RESTART_SERVICE")); }