public void Stop_TrackingTest() { MessagingCenter.Subscribe <StopBackgroundLocationTrackingMessage>(this, "StopBackgroundLocationTrackingMessage", message => { Assert.IsFalse(BackgroundLocationService.isTracking()); }); BackgroundLocationService.Stop_Tracking(); }
/// <summary> /// Enabels and disables location tracking /// </summary> async void SfSwitch_StateChanged(System.Object sender, Syncfusion.XForms.Buttons.SwitchStateChangedEventArgs e) { IBackgroundLocationService back = App.IoCContainer.GetInstance <IBackgroundLocationService>(); if (e.NewValue == true) { //BackgroundLocaitonService.Tracking = true; back.Start_Tracking(); CrossSecureStorage.Current.SetValue("Location", "true"); CrossToastPopUp.Current.ShowToastMessage("Location Tracking Enabled"); } else { //BackgroundLocaitonService.Tracking = false; back.Stop_Tracking(); //await DisplayAlert("Attention", "Disabled", "OK"); CrossToastPopUp.Current.ShowToastMessage("Location Tracking Disabled"); CrossSecureStorage.Current.SetValue("Location", "false"); } }