how to get ip address for mobile network in android studio code example
Example: android studio get wifi ip address
WifiManager wifiMgr = (WifiManager) getSystemService(WIFI_SERVICE);
WifiInfo wifiInfo = wifiMgr.getConnectionInfo();
int ip = wifiInfo.getIpAddress();
String ipAddress = Formatter.formatIpAddress(ip);
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />