Getting MAC address in Android 6.0

后端 未结 10 2295
醉梦人生
醉梦人生 2020-11-27 04:48

I\'m developing an app that gets the MAC address of the device, but since Android 6.0 my code doesn\'t work, giving me an incorrect value.

Here\'s my code...

10条回答
  •  面向向阳花
    2020-11-27 05:22

    The answers are mostly correct, but keep care, that there is a change in android 7. You will need to use the

    DevicePolicyManager and the Method getWifiMacAddress. The official docs has a typo, which means that you shouldnt copy/paste it from there.

    DevicePolicyManager.getWifiMacAddress()
    

    Refs: https://developer.android.com/about/versions/nougat/android-7.0-changes.html

    Get Device mac adress in Android Nougat and O programmatically

提交回复
热议问题