淘先锋技术网

首页 1 2 3 4 5 6 7
public static String getInfo()
    {
       WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
       WifiInfo info = wifi.getConnectionInfo();
 
       String maxText = info.getMacAddress();
       String ipText = intToIp(info.getIpAddress());
       String status = "";
       if (wifi.getWifiState() == WifiManager.WIFI_STATE_ENABLED)
       {
           status = "WIFI_STATE_ENABLED";
       }
       String ssid = info.getSSID();
       int networkID = info.getNetworkId();
       int speed = info.getLinkSpeed();
       return "mac:" + maxText + "\n\r"
              + "ip:" + ipText + "\n\r"
              + "wifi status :" + status + "\n\r"
              + "ssid :" + ssid + "\n\r"
              + "net work id :" + networkID + "\n\r"
              + "connection speed:" + speed + "\n\r"
              ;
    }

 private String intToIp(int ip)

    {

       return (ip & 0xFF) + "." + ((ip >> 8) & 0xFF) + "." + ((ip >> 16) & 0xFF) + "."

              + ((ip >> 24) & 0xFF);

    }

 

结伴旅游,免费的交友网站:www.jieberu.com

推推族,可以免费得门票,游景区哦:www.tuituizu.com

 

转载于:https://www.cnblogs.com/rabbit-bunny/p/4171231.html