xamarin get device mac address 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";
}