private async Task UpdateLocationInfo() { var latLng = await FamilyLocationService.GetUserLatLng(); var db = new Database(); var location = new Location() { LocationLatLng = latLng.Latitude + " " + latLng.Longitude, Time = DateTime.UtcNow }; db.insertIntoTable(location); string Address_ShortName; string Address_country; string Address_administrative_area_level_1; string Address_administrative_area_level_2; string Address_administrative_area_level_3; string Address_colloquial_area; string Address_locality; string Address_sublocality; string Address_neighborhood; FamilyLocationService.ReverseGeoLoc(latLng.Latitude.ToString(), latLng.Longitude.ToString(), out Address_ShortName, out Address_country, out Address_administrative_area_level_1, out Address_administrative_area_level_2, out Address_administrative_area_level_3, out Address_colloquial_area, out Address_locality, out Address_sublocality, out Address_neighborhood); }
private async Task UpdateLocationInfo() { var latLng = await FamilyLocationService.GetUserLatLng(); var locationName = FamilyLocationService.ReverseGeoLoc(latLng.Latitude.ToString(), latLng.Longitude.ToString()).Result; var db = new Database(); var location = new Location() { LocationLatLng = latLng.Latitude + " " + latLng.Longitude, Time = DateTime.UtcNow, LocationName = locationName }; db.insertIntoTable(location); }
public override View GetView(int position, View convertView, ViewGroup parent) { var view = convertView ?? activity.LayoutInflater.Inflate(Resource.Layout.list_view, parent, false); var txtId = view.FindViewById <TextView>(Resource.Id.txtView_Id); var txtLatLng = view.FindViewById <TextView>(Resource.Id.txtView_LatLng); var txtLocationName = view.FindViewById <TextView>(Resource.Id.txtView_Name); var txtDate = view.FindViewById <TextView>(Resource.Id.txtView_Date); txtId.Text = listLocation[position].Id.ToString(); txtLatLng.Text = listLocation[position].LocationLatLng; txtDate.Text = listLocation[position].Time.ToLocalTime().ToString(); if (string.IsNullOrEmpty(listLocation[position].LocationName)) { var latLng = listLocation[position].LocationLatLng.Split(","); var locationName = FamilyLocationService.ReverseGeoLoc(latLng[0], latLng[1]).Result; listLocation[position].LocationName = locationName; } txtLocationName.Text = listLocation[position].LocationName.ToString(); return(view); }