Hi,
ia m trying to determine the user location so that. can redirect to the store page based on his location (which is the country or state)
I know it can be done with Xamarin Essentials but what if he did not grant the access?
i though of getting the location from his IP.
I tried below code:
private string GetLocalAddress()
{
var host = Dns.GetHostEntry(Dns.GetHostName());
foreach (var ip in host.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
return ip.ToString();
}
}
throw new Exception("Local IP Address Not Found!");
}
but getting:
System.Net.Sockets.SocketException: Could not resolve host 'iPhone'
Kindly advise..