android get phone IP address
<p>I'm trying to get and then send IP address from android application.</p>

<pre><code>WifiManager wm = (WifiManager) getSystemService(WIFI_SERVICE);
String ip = Formatter.formatIpAddress(wm.getConnectionInfo().getIpAddress());
</code></pre>

<p>this works if mobile is online from wifi connection. But if I'll turn on mobile data then this returns <code>0.0.0.0</code> as IP. How can I solve that?</p>