get mac address xamarin forms code example
Example: xamarin get device mac address
public static string GetDeviceMacAddress()
{
foreach (var netInterface in NetworkInterface.GetAllNetworkInterfaces())
{
if (netInterface.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 ||
netInterface.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
{
var address = netInterface.GetPhysicalAddress();
return BitConverter.ToString(address.GetAddressBytes());
}
}
return "NoMac";
}