I have created a brand new .net MAUI App (VS 2022 Community).
I am trying to ping an IP address from my MainPage.
My code:
IPAddress ipAddress = IPAddress.Parse(hostOrIp);
PingReply reply = await ping.SendPingAsync(ipAddress);
if (reply.Status == IPStatus.Success)
{
return true;
}
else
{
return false;
}
However, the code above does not seem to work at all, not on Android emulator not on a physical Android device either. The requisite permissions are already taken care of. I am getting a "System.Net.NetworkInformation.IPStatus.TimedOut" reply every time even to well known IP addresses like 8.8.8.8.
What could be the problem?