In an android application, I want to get my dynamic local ip address that appears when I type "ipconfig" in cmd. Using this code I found somewhere here on stackoverflow, it is returning an ip address but it is not the same as the one from ipconfig. Why is that? How do I get the exact IP address that appeared using ipconfig?
public String getLocalIpAddress() {
       WifiManager wifiManager = (WifiManager)      
       getSystemService(WIFI_SERVICE);
       WifiInfo wifiInfo = wifiManager.getConnectionInfo();
       int ip = wifiInfo.getIpAddress();
       String ipString = String.format(
       "%d.%d.%d.%d",
       (ip & 0xff),
       (ip >> 8 & 0xff),
       (ip >> 16 & 0xff),
       (ip >> 24 & 0xff));
       return ipString;
}
 
     
     
    