Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        public override void OnDestroy()
        {
            apiClient.Disconnect();
            locRequest.Dispose();

            IsStarted = false;

            SendBroadcast(new Intent("RESTART_SERVICE"));
        }