Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Get Wifi IP

Get Wifi IP

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Get Wifi IP

Postby puxdroid » Mon Jan 11, 2010 10:32 am

Anybody knows how to get the Wifi IP?

I have tried this code, but give me the loopback IP

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. InetAddress thisIp;
  3.  
  4.                 try {
  5.  
  6.                         thisIp = InetAddress.getLocalHost();
  7.  
  8.                         mTexServerInfo.setText(thisIp.getHostAddress());
  9.  
  10.                 } catch (UnknownHostException e) {
  11.  
  12.                         mTexServerInfo.setText("Error obtaining the local address");
  13.  
  14.                         Log.e(TAG, "ERROR obtaining the local address", e);
  15.  
  16.                 }
  17.  
  18.  
Parsed in 0.011 seconds, using GeSHi 1.0.8.4


Thanks in advance!
puxdroid
Developer
Developer
 
Posts: 49
Joined: Wed Nov 25, 2009 11:57 am

Top

Re: Get Wifi IP

Postby puxdroid » Mon Jan 11, 2010 12:06 pm

I have solved the problem. Use this code:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         private String getWifiIp() {
  3.  
  4.                 WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
  5.  
  6.  
  7.  
  8.                 int ip = wifiManager.getConnectionInfo().getIpAddress();
  9.  
  10.                 return (ip & 0xFF) + "." + ((ip >> <img src="http://www.anddev.org/images/smilies/cool.png" alt="8)" title="Cool" /> & 0xFF) + "."
  11.  
  12.                                 + ((ip >> 16) & 0xFF) + "." + ((ip >> 24) & 0xFF);
  13.  
  14.  
  15.  
  16.         }
  17.  
  18.  
Parsed in 0.011 seconds, using GeSHi 1.0.8.4
puxdroid
Developer
Developer
 
Posts: 49
Joined: Wed Nov 25, 2009 11:57 am

Re: Get Wifi IP

Postby lizemountain » Fri Jan 22, 2010 10:54 am

puxdroid wrote:I have solved the problem. Use this code:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         private String getWifiIp() {
  2.                 WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
  3.  
  4.                 int ip = wifiManager.getConnectionInfo().getIpAddress();
  5.                 return (ip & 0xFF) + "." + ((ip >> <img src="http://www.anddev.org/images/smilies/cool.png" alt="8)" title="Cool" /> & 0xFF) + "."
  6.                                 + ((ip >> 16) & 0xFF) + "." + ((ip >> 24) & 0xFF);
  7.  
  8.         }
  9.  
Parsed in 0.011 seconds, using GeSHi 1.0.8.4


it's a good method!
thanks!
lizemountain
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Jan 22, 2010 10:51 am

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests