Captures d'écran

GetNetInfo-1.4 WiFi

GetNetInfo-1.4 3G

GetNetInfo-1.4 Notification

Code snippet :

  /** 
    * Show WLAN interface informations
    * cf. http://www.droidnova.com/get-the-ip-address-of-your-device,304.html
    * **/
   private void showIPAddress1() {
   	TextView tv;
   	WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);    	
   	WifiInfo wifiInfo = wifiManager.getConnectionInfo();
   	DhcpInfo dhcpInfo = wifiManager.getDhcpInfo();    	
   	
   	tv = (TextView) findViewById(R.id.id_wlan_ssid);
   	tv.setText(wifiInfo.getSSID());    	
   	tv = (TextView) findViewById(R.id.id_wlan_rssi);
   	tv.setText(""+wifiInfo.getRssi());
   	
   	tv = (TextView) findViewById(R.id.id_wlan_mac_address);
   	tv.setText(wifiInfo.getMacAddress());    	
   	tv = (TextView) findViewById(R.id.id_wlan_ip_address);
   	tv.setText(intToIp(dhcpInfo.ipAddress));
   	tv = (TextView) findViewById(R.id.id_wlan_netmask);
   	tv.setText(intToIp(dhcpInfo.netmask));    	    	
   	tv = (TextView) findViewById(R.id.id_wlan_gateway);
   	tv.setText(intToIp(dhcpInfo.gateway));
   	tv = (TextView) findViewById(R.id.id_wlan_dns1);
   	tv.setText(intToIp(dhcpInfo.dns1));
   	tv = (TextView) findViewById(R.id.id_wlan_dhcp);
   	tv.setText(intToIp(dhcpInfo.serverAddress));
   	tv = (TextView) findViewById(R.id.id_wlan_dhcplease);
   	tv.setText(""+dhcpInfo.leaseDuration);    	       
   }
  /**
    * Convert int IP adress to String 
    * cf. http://teneo.wordpress.com/2008/12/23/java-ip-address-to-integer-and-back/
    */
   private String intToIp(int i) {
   	return ( i        & 0xFF) + "." +
   	((i >>  8 ) & 0xFF) + "." +
   	((i >> 16 ) & 0xFF) + "." +
       ((i >> 24 ) & 0xFF)
       ;
   }

Documentation :

TCP/IP Network

ListView