How do I get specific information about a device when my Android phone is hot?

Source: Internet
Author: User

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?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.