출처: https://itekblog.com/android-get-mobile-ip-address/
** Get IP For mobile */
public static String getMobileIP() {
try {
for (Enumeration<NetworkInterface> en = NetworkInterface
.getNetworkInterfaces(); en.hasMoreElements();) {
NetworkInterface intf = (NetworkInterface) en.nextElement();
for (Enumeration<InetAddress> enumIpAddr = intf
.getInetAddresses(); enumIpAddr.hasMoreElements();) {
InetAddress inetAddress = enumIpAddr.nextElement();
if (!inetAddress.isLoopbackAddress()) {
String ipaddress = inetAddress .getHostAddress().toString();
return ipaddress;
}
}
}
} catch (SocketException ex) {
Log.e(TAG, "Exception in Get IP Address: " + ex.toString());
}
return null;
}
이거로 와이파이 말고 모바일 아이피가져오면 192.0.0.x 이렇게 뜨던데 원래 통신사 아이피 대역이랑 다르더라고요
skt인데 skt는 203.226.x.x or - 223.32.0.0 ~ 223.63.255.255 이렇게 쓰더라고요 ㅠㅠ
모바일 아이피 가져오는 코드나 참고 글 좀 부탁드립니다!!
출처: https://namu.wiki/w/%ED%86%B5%EC%8B%A0%EC%82%AC%20IP