I have the following code below to access the current devices MAC address. When updating the application to android 11 and higher, NetworkInterface.getHardwareAddress is now returning a null value. I believe it is a network permissions error but I am unsure what permissions to add or change? Code as follows:
try {
byte[] macBytes = intf.getHardwareAddress();
if (macBytes == null) {
macAddress = "MAC Address Unknown";
} else {
// Deal with returned mac address here