When trying to query the PhysicalAddress of a NetworkInterface in C# (in Unity) specifically on Android, it returns empty rather than the mac address. On Windows (In the Unity Editor) it works properly. How can I actually get the physical address?
public static void GetAddresses()
{
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in nics)
{
Debug.Log($"{adapter.Name} - {adapter.GetPhysicalAddress()}");
}
}
This returns the following in the log on Android (Samsung, specifically) devices:
wlan0 -
dummy0 -
lo -
rmnet_data1 -
Ultimately, I'm trying to get a "primary" mac address to tie to a user.