Solve the problem that the WiFi MAC address obtained by Android 6.0 is 02:00:00:00:00

preface:

The previous project was relatively old, the mobile phone version was relatively low, and eclipse was used for development. You need to get the WiFi MAC address of your mobile phone. The following codes are used:

▲ problems:

Using this method, you can normally obtain the WiFi MAC address on the simulator, but on Android 6.0 system, there is a problem in obtaining it, and the return is "02:00:00:00:00"

▲ problem analysis:

Originally, in order to give users more data protection, Google officials removed the programmable access to local hardware identifiers in applications through WiFi and Bluetooth APIs from this version 6.0. Now the wifiinfo. Getmacaddress () and Bluetooth adapter. Getaddress () methods will both return 02:00:00:00:00

▲ solution:

As the saying goes, there are policies at the top and Countermeasures at the bottom. We can use the following code to obtain the mobile phone WiFi MAC address, which can also solve the problem of versions above 6.0. It is worth noting that the simulator cannot be obtained by using the following code!

The mobile phone must be in the network state, and don't forget to add permissions

summary

The above is the solution for Android 6.0 to obtain WiFi MAC address 02:00:00:00:00:00 introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

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
分享
二维码
< <上一篇
下一篇>>