public async Task<VenuesResponse> GetVenues(string query, GeoCoords coords) { var v = DateTime.Now.ToString("yyyyMMdd"); var ll = string.Format("{0},{1}", coords.Latitude, coords.Longitude); var url = string.Format(@"https://api.foursquare.com/v2/venues/search?ll={0}&query={1}&client_id={2}&client_secret={3}&v={4}", ll, query, _CLIENT_ID, _CLIENT_SECRET, v); var client = new HttpClient(); var response = await client.GetStringAsync(url); JObject o = JObject.Parse(response); return await Task.Factory.StartNew(() => JsonConvert.DeserializeObject<VenuesResponse>(o["response"].ToString())); }
public async Task<CoffeeRadar.Core.Models.GeoCoords> GetGeoCoordinatesAsync () { try { var locator = new Geolocator() {DesiredAccuracy = 30}; var position = await locator.GetPositionAsync(30000); var result = new GeoCoords { Latitude = position.Latitude, Longitude = position.Longitude }; return result; } catch (Exception e) { } return null; }