title: how to obtain the ip address of the connected wifi router in android programmatically?
body: <p>I want to obtain the ip address of the the wifi router to which my android phone is connected? I know that we can get the mac/BSSId and SSID by using the android APIS but I don't find the way to find the way to find the ip address of it?</p>
  
  <p>I found the code for obtaining the ip address of phone owns wifi router</p>
  
  <pre><code>WifiManager myWifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
  WifiInfo myWifiInfo = myWifiManager.getConnectionInfo();
  int ipAddress = myWifiInfo.getIpAddress();
  System.out.println("WiFi address is " + android.text.format.Formatter.formatIpAddress(ipAddress))
  </code></pre>
  
  <p>but failed to get what I want</p>