protected static String getLocalMacIdFromIp(){
String strMacAddr = "";
try {
InetAddress ip = getLocalInetAddress();
if(ip == null || "".equals(ip)){
Log.e("ip:","获取ip为空");
return strMacAddr;
}
byte[] b = NetworkInterface.getByInetAddress(ip)
.getHardwareAddress
android获取mac地址(亲测有效)
![](https://img-home.csdnimg.cn/images/20240711042549.png)