location using wifi ip
<p>I tried to find ip of my network and get location using that ip. But my code returns correct ip(223.187.19.157) when connected to 2G networks. But when i connect to my wifi, it returns the ip like this <strong>fe80::7ad6:f0ff:fe2b:dca6%wlan0</strong> . Can anyone please help me to find my wifi ip in correct format. code follows</p>

<pre><code>public String getIpAddress() {
        try {
            for (Enumeration&lt;NetworkInterface&gt; en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
                NetworkInterface intf = en.nextElement();
                for (Enumeration&lt;InetAddress&gt; enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
                    InetAddress inetAddress = enumIpAddr.nextElement();
                    if (!inetAddress.isLoopbackAddress()) {
                        return inetAddress.getHostAddress().toString();
                    }
                }
            }
        } catch (SocketException ex) {
            ex.printStackTrace();
        }
        return null;
    }
</code></pre>
