I'm using Android with Api level 8 and I want to get the Address of my Ethernet interface (eth0).
On API level 8, the NetworkInterface class don't have the function getHardwareAddress(). The WifiManager also does not work since this is not an Wireless interface.
Thanks in advance!
Maybe my answer will be helpful to a few of you out there, and at least funny for the rest of you.
I was trying to get the ethernet MAC address for an Android TV device, to try to find the actual manufacturer the MAC address is registered to. I connected to the device with adb and used Joel F's great answer above and it worked great.
Then I flipped the box over and there it is on a sticker on the bottom of the device.
So if you don't need it programatically, try flipping the device over first.
P.S. I contacted the manufacturer the address is registered to, and they said they don't make this model and that other manufacturers copy their MAC addresses.
This is my solution based on the Joel F answer. Hope it helps someone!
Assuming your ethernet interface is eth0, try opening and reading the file
/sys/class/net/eth0/address
.Check also /sys/class/efuse/mac at least on Amlogic platforms.
this way to use java fix it; maybe can help you