Uzyskaj mój adres IP ip Android

Jak mogę uzyskać adres IP mojego telefonu, gdy jest podłączony pod wifi?

Znalazłem metodętutaj ale zwraca coś takiego jak 24.182.239.255, nawet jeśli jestem pod wifi i oczekuję czegoś takiego jak 192.168.1.10.

Chciałbym coś takiego:

if (you are under wifi)
    String ip4 = getWifiIP()
else
    String ip4 = getIPAddress with the method linked before

Wielkie dzięki!

questionAnswers(9)

yourAnswerToTheQuestion