Answers for "xamarin get device mac address"

0

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";
    }
Posted by: Guest on November-14-2020

Browse Popular Code Answers by Language