Package COM. lenovo. xiaoshan. test; import android. app. activity; import android. bluetooth. export thadapter; import android. content. context; import android. content. intent; import android.net. wiFi. wifiinfo; import android.net. wiFi. wifimanager; import android. OS. bundle; import android. widget. textview;/*** get the MAC address of the phone WiFi * @ author single redwoo **/public class getmacipinfoactivity extends activity {/** called when Ctivity is first created. */Private Static final int request_enable_bt = 3; private wifimanager mwifi; private string wifimac; @ overridepublic void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); setcontentview (R. layout. main); mwifi = (wifimanager) getsystemservice (context. wifi_service); If (! Mwifi. iswifienabled () {mwifi. setwifienabled (true);} wifiinfo = mwifi. getconnectioninfo (); If (wifimac = wifiinfo. getmacaddress () = NULL) {wifimac = "no wifi device";} textview MAC = (textview) findviewbyid (R. id. macview); Mac. settextsize (16); // view the connected Wi-Fi information. In the android SDK, we provide an object called wifiinfo, which can be used by wifimanager. getconnectioninfo. Wifiinfo contains information about the current connection. // Getbssid () Get bssid attributes // getdetailedstateof () Get client connectivity // gethiddenssid () Get SSID hidden // getipaddress () Get IP address // getlinkspeed () get the connection speed // getmacaddress () Get the MAC address // getarg () Get the signal of the 802.11n network // getssid () Get the SSID // getsupplicanstate () obtain the status information of a specific client. stringbuffer sb = new stringbuffer (); sb. append ("\ n get bssid attribute (MAC address of the connected WiFi device):" + wifiinfo. getbssid (); // sb. append ("getdetailedstateof () to obtain client Connectivity:"); sb. append ("\ n to obtain whether the SSID is hidden:" + wifiinfo. gethiddenssid (); sb. append ("\ n get IP Address:" + wifiinfo. getipaddress (); sb. append ("\ n get connection speed:" + wifiinfo. getlinkspeed (); sb. append ("\ n get MAC address (MAC address of the phone's network adapter):" + wifimac); sb. append ("\ n gets the signal of the 802.11n Network:" + wifiinfo. getarg (); sb. append ("\ n get the SSID (the Network Name of the connected WiFi):" + wifiinfo. getssid (); sb. append ("\ n to obtain information about the specific client status:" + wifiinfo. getsupplicantstate (); Mac. settext ("WiFi network information:" + sb. tostring () + "\ n Bluetooth Mac:" + btmac );}}