Code example for WifiInfo

Methods: describeContents, getNetworkId, toString

0
	} 
 
	private String collectWiFiStats() {
		String info = "WiFi: NOT Connected";
		WifiInfo wifiInfo = wifiManager.getConnectionInfo();
		wifiInfo.describeContents();
		int id = wifiInfo.getNetworkId();
		Log.i("WiFiInfo: ", wifiInfo.toString());
		if (-1 == id) {
			Log.i("WiFi: ", "NOT Connected");
		} else { 
			Log.i("WiFi: ", "Network id = " + id);
			info = wifiInfo.toString();
		} 
		return info;
	} 
 
	private HashMap<String, String> collectConnectivityManagerStats() {
		HashMap<String, String> stats = new HashMap<String, String>();
		ConnectivityManager connectivityManager = (ConnectivityManager) getApplicationContext()
				.getSystemService(Context.CONNECTIVITY_SERVICE);