protected override void OnResume() { if (gps == null) { gps = new GPSFetcher(); } startGPS(); }
protected override void OnStart() // This will be executed after the app constructor. { gps = new GPSFetcher(); startGPS(); Task.Run(async() => { if (!CrossConnectivity.Current.IsConnected) { switch (Device.RuntimePlatform) { case Device.Android: DependencyService.Get <SnackInterface>().SnackbarShowIndefininte("Internet is not available"); break; case Device.iOS: CrossToastPopUp.Current.ShowToastMessage("Internet is not available"); break; default: break; } while (!CrossConnectivity.Current.IsConnected) { await Task.Delay(100); } switch (Device.RuntimePlatform) { case Device.Android: DependencyService.Get <SnackInterface>().SnackbarShow("Internet connection has been established"); break; case Device.iOS: CrossToastPopUp.Current.ShowToastMessage("Internet connection has been established"); break; default: break; } } List <Post> posts = await conn.getDataAsync(); posts = GlobalFuncs.filterInvaliedPosts(posts); // Does not care about distance nor *ML while (!GlobalFuncs.gpsOn || !GlobalFuncs.settingsActive) { await Task.Delay(25); } GlobalFuncs.fvm.updateListElements(posts); GlobalFuncs.mvm.updateListElements(posts); // Does not care about *ML only distance GlobalFuncs.uvm.updateListElements(posts); // Cares about both *ML and distance }); }