Code example for WifiInfo

Methods: getIpAddressgetLinkSpeedgetMacAddressgetSSID

0
	private void getWifiInfo() { 
		mWifiManager = (WifiManager) DemoServerActivity.this
				.getSystemService(Context.WIFI_SERVICE);
		mWifiManager.setWifiEnabled(true);
		WifiInfo info = mWifiManager.getConnectionInfo();
		String infoStr = "IP:" + Integer.toHexString(info.getIpAddress())
				+ "\nIP:" + intToIp(info.getIpAddress()) + "\nSSID:"
				+ info.getSSID() + "\nLinkSpeed:" + info.getLinkSpeed()
				+ "\nMacAddress:" + info.getMacAddress();
 
		int ip = info.getIpAddress();
		String ipHexStr = Integer.toHexString(ip);
		mIpInfoTextView.setText(ipHexStr);
 
		Log.i("wifi", "SSID: " + info.getSSID());
		Log.i("wifi", "IPAddress: " + ip);
		Log.i("wifi", "IPAddress String: " + intToIp(ip));
		Log.i("wifi", "LinkSpeed: " + info.getLinkSpeed());
		Log.i("wifi", "MacAddress: " + info.getMacAddress());
 
		Toast.makeText(DemoServerActivity.this, infoStr, Toast.LENGTH_SHORT)
				.show();
	} 
 
Contextual code suggestions in your IDE  Get Codota for Java