I have tried below code but it keeps on giving the me iPhone(ie.Device) IP Address. But I want to get a ROUTER IP ADDRESS
public string GetIPAddress()
{
String ipAddress = "";
foreach (var netInterface in NetworkInterface.GetAllNetworkInterfaces())
{
Console.WriteLine(netInterface);
if (netInterface.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 ||
netInterface.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
{
foreach (var addrInfo in netInterface.GetIPProperties().UnicastAddresses)
{
if (addrInfo.Address.AddressFamily == AddressFamily.InterNetwork)
{
ipAddress = addrInfo.Address.ToString();
}
}
}
}
iPhone IPAddress: 192.168.0.19 Router: 192.168.0.1
I can do the Hacky way of removing the '9' from the last set of IP address. But I don't want to do this.

You can use the following code to get a ROUTER IP ADDRESS(Gateway address) from Android side.
Create a DependenceService in Forms folder.
Then achieve this interface in the android folder.
And add following permission in the AndroidManifest.xml
In the Xamarin forms, you can get ROUTER IP ADDRESS like following code.