protected async override void OnSleep() { try { // Handle when your app sleeps AppData.LastActivity = DateTime.Now; if (await FileSystem.Exists("log.txt")) { LogTracking.EntryToLogFile(); } if (AddNewAudioView._isRecording) { AddNewAudioView.StopRecord.Invoke(); } } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }