1

I'm trying to get and then send IP address from android application.

WifiManager wm = (WifiManager) getSystemService(WIFI_SERVICE);
String ip = Formatter.formatIpAddress(wm.getConnectionInfo().getIpAddress());

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

gsiradze
  • 4,583
  • 15
  • 64
  • 111

0 Answers0