public override bool OnStopJob(JobParameters @params)
        {
            WatchCollectionThread.Abort();

            WatchCollectionThread = null;

            if (SmartWatchPage.ClearGraphs != null)
            {
                SmartWatchPage.ClearGraphs();
            }

            var message = new CollectionMessage {
                Message = "Connection Restarting..."
            };

            Device.BeginInvokeOnMainThread(() => MessagingCenter.Send(message, "CollectionMessage"));

            return(true);
        }
        public void resetConnection()
        {
            //await DisplayAlert("Notice", "Disconnected from Ticwatch", "OK");
            try
            {
                if (SmartWatchPage.ClearGraphs != null)
                {
                    SmartWatchPage.ClearGraphs();
                }
            }
            catch (Exception ex)
            {
                ExceptionErrorLogger.writeFileOnInternalStorage(ex.ToString());
            }
            try
            {
                if (inputStream != null)
                {
                    inputStream.Close();
                    inputStream = null;
                }
            }
            catch (IOException ex)
            {
                ExceptionErrorLogger.writeFileOnInternalStorage(ex.ToString());
            }

            try
            {
                if (serverClientSocket != null)
                {
                    serverClientSocket.Close();
                    serverClientSocket = null;
                }
            }
            catch (IOException ex)
            {
                ExceptionErrorLogger.writeFileOnInternalStorage(ex.ToString());
            }

            ConnectToWatchAsync();
        }