public async Task ProceedCommand() { //check: if location is avalable, then proceed, if cannot get device location, can't proceed try { var locator = CrossGeolocator.Current; locator.DesiredAccuracy = 50; Plugin.Geolocator.Abstractions.Position position; string address; int isGpsEnabled; if (locator.IsGeolocationEnabled) { isGpsEnabled = 1; try { position = await locator.GetPositionAsync(10000); address = await geocoder.GetCityFromLocation(new GeoLocation(position.Latitude, position.Longitude)); } catch (Exception ex) { address = "Unknown"; position = new Plugin.Geolocator.Abstractions.Position(); position.Latitude = 0; position.Longitude = 0; } } else { isGpsEnabled = 0; address = "Unknown"; position = new Plugin.Geolocator.Abstractions.Position(); position.Latitude = 0; position.Longitude = 0; } //insert sales here await insertSales(position, address, isGpsEnabled); SelectedCustomer = null; InsertSalesItemsList.Clear(); Close(this); } catch (Exception ex) { } }