Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Get Mac address of Device in Xamarin

  //******************* Source: NAYCode.com
private string GetDeviceInfo()
        {
            string mac = string.Empty;
            string ip = string.Empty;

            foreach (var netInterface in NetworkInterface.GetAllNetworkInterfaces())
            {
                if (netInterface.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 ||
                    netInterface.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
                {
                    var address = netInterface.GetPhysicalAddress();
                    mac = BitConverter.ToString(address.GetAddressBytes());

                    IPAddress[] addresses = Dns.GetHostAddresses(Dns.GetHostName());
                    if (addresses != null && addresses[0] != null)
                    {
                        ip = addresses[0].ToString();
                        break;
                    }
                }
            }

            return mac;
        }
      
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# create class from parent class 
Csharp :: foreach c# linq example 
Csharp :: how to cut a string in c# 
Csharp :: c# divide two integers get float 
Csharp :: c# array zaheln speichern 
Csharp :: generate UUID id for my entities 
Csharp :: unity auto scroll 
Csharp :: c# caractère cacher mot de passe 
Csharp :: c#l list<string initialize 
Csharp :: unique field in class model .net core 
Csharp :: linq from list c# 
Csharp :: How to make enemy shooting 
Csharp :: what is float in c# 
Csharp :: how to find length of list c# 
Csharp :: int model property shows 0 in textbox .net core 
Csharp :: remove string inside curly braces C# 
Csharp :: linear search algorithm c# 
Csharp :: Create a button in unity to show ad 
Csharp :: structure in c sharp with example 
Csharp :: Reading emails from Gmail in C# 
Csharp :: convert video to byte array c# 
Csharp :: letter to number converter c# 
Csharp :: .net core copy file in folder to root 
Csharp :: c# list contains null 
Csharp :: display image script unity 
Csharp :: c# external execute batch 
Csharp :: Get replace normal text from word document in C# 
Csharp :: C# Convert xml to datatable 
Csharp :: c# how to get a securestring from string 
Csharp :: Triangle perimeter 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =