1. The information of connected equipment is stored in/data/misc/dhcp/dnsmasq.leases
2. Its format is:
/system ID, no value required/client MAC address/client IP address/client device name/weighted after MAC address, no value required
<span style= "FONT-SIZE:14PX;" >1357041758 88:00:12:34:56:78 192.168.43.133 android-184cc6c105d7a3b 01:88:00:12:34:56:78</span>
2, refer to the Wifiservie.java Getclientip () method, you can customize this method to obtain the device name, as follows:
<span style= "FONT-SIZE:14PX;" >public string Getclientdevicename (String deviceaddress) {//Pass MAC address in enforceaccesspermission (); Textutils.isempty (deviceaddress)) {return null;} Read the corresponding file information for (String s:readclientlist ("/data/misc/dhcp/dnsmasq.leases")) {if (S.indexof (deviceaddress)! =-1) { string[] fields = S.split ("");//Verify if the data is broken if (Fields.length > 4) {//returns to 4th field return fields[3];}} return null;} </span>
Reprint Please specify source: Zhou Mushi's csdn blog Http://blog.csdn.net/zhoumushui
My github: Zhou Mushi's GitHub Https://github.com/zhoumushui
How do I get specific information about a device when my Android phone is hot?