Code example for WifiManager

Methods: getConnectionInfogetWifiState

0
        } 
    }; 
 
    OnClickListener updateButtonHandler = new OnClickListener() {
        public void onClick(View v) { 
            final WifiInfo wifiInfo = mWifiManager.getConnectionInfo(); 
 
            setWifiStateText(mWifiManager.getWifiState()); 
            mBSSID.setText(wifiInfo.getBSSID()); 
            mHiddenSSID.setText(String.valueOf(wifiInfo.getHiddenSSID())); 
            int ipAddr = wifiInfo.getIpAddress(); 
            StringBuffer ipBuf = new StringBuffer(); 
            ipBuf.append(ipAddr  & 0xff).append('.'). 
                append((ipAddr >>>= 8) & 0xff).append('.'). 
                append((ipAddr >>>= 8) & 0xff).append('.'). 
                append((ipAddr >>>= 8) & 0xff); 
 
            mIPAddr.setText(ipBuf); 
            mLinkSpeed.setText(String.valueOf(wifiInfo.getLinkSpeed())+" Mbps"); 
            mMACAddr.setText(wifiInfo.getMacAddress()); 
            mNetworkId.setText(String.valueOf(wifiInfo.getNetworkId()));