How to get the missing Wifi MAC Address in Android Marshmallow and later?

后端 未结 3 1911
清酒与你
清酒与你 2020-12-05 11:23

Android developers looking to get the Wifi MAC Address on Android M may have experienced an issue where the standard Android OS API to get the MAC Address returns a fake MAC

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-05 11:53

    Resolved!

    The MAC Address can still be grabbed from the path:

    "/sys/class/net/" + networkInterfaceName + "/address";
    

    Simply doing a file read, or a cat of that file will show the Wifi MAC Address.

    Network interface names are usually along the lines of "wlan0" or "eth1"

提交回复
热议问题