I Have two pieces of code, one to get adresses from a position & one to get position from adress.
GetAddressesForPosition
var geoCoder = new Geocoder();
Task.Run(async () =>
{
var possibleAddresses = await geoCoder.GetAddressesForPositionAsync(position);
Device.BeginInvokeOnMainThread(() =>
{
var firstAdress = possibleAddresses.FirstOrDefault();
GeolocationAdressEntry.Text = firstAdress;
//GeolocationAdressEntry.Text = $@"{firstAdresse.} {firstAdresse.PostalCode} {firstAdresse.Locality}";
});
});
For this code, I not have any exception and the code never goes after
var possibleAddresses = await geoCoder.GetAddressesForPositionAsync(position);
GetPositionsForAddress
var elem = (Entry)sender;
var geoCoder = new Geocoder();
IEnumerable<Xamarin.Forms.Maps.Position> loc;
try
{
loc = await geoCoder.GetPositionsForAddressAsync(elem.Text);
var firstLoc = loc.FirstOrDefault();
var adress = elem.Text;
CreateNewPin(firstLoc, adress);
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
For this one it thrown an error : "grpc failed". If needed I can post the complete error.
This is boring because it works perfectly in IOS.
I tried on emulators ( Genymotion & adb ) with different versions and also in a true device. Same issue.