Detailed experience of Android macaddress adaptation

Get the MAC address below Android 6.0

The MAC address we get is usually written as follows:

Android 6.0 and above, 7.0 and below

After Android 6.0, the Mac can no longer be obtained through WiFi manager, and the obtained Mac will be fixed: 02:00:00:00:00.

However, the SDK I developed is the MAC obtained through WiFi manager.

Android SDK was later adapted to 6.0. The MAC address can be obtained on 6.0 through cat / sys / class / net / WLAN 0 / address.

Android 7.0 and above

After Android 7.0, the MAC address will not be obtained through the above adaptation method.

After investigation and testing, there is still a way to go back to the MAC address on 7.0:

(1) Obtain the bound MAC address through the IP address

(2) Scan each network interface to obtain the MAC address

(3) Pass busy@R_ 709_ 2419 @ get mac address stored locally

Screenshot of comparison effect

The above three methods are compared with the current method of SDK developed by me and the method of obtaining MAC address through WiFi manager. The results are as follows (7.0 devices are limited and only cover some models):

conclusion

Through the above comparison, the combination of obtaining MAC address through IP and scanning network interface can achieve accurate results.

The MAC address obtained through IP has high priority. Only when it cannot be obtained, the MAC address obtained by scanning the network interface can be used.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>