Android Question How to get non Lan IP address

scottie

Member
Licensed User
Longtime User
I've been searching and searching. Info is probably somewhere, but I could not find it.

How do I get the current IP address of device when NOT connected to my Lan? Cellular Network IP address.
I can get the Lan IP address all day long, but when device is on cell network, that's my problem.
ssocket.GetMyWifiIP only works for Lan connections

Any help would be appreciated. Thanks a bunch
-Scott
 

scottie

Member
Licensed User
Longtime User
Hi Erel,
yeah, I tried that.

Dim ssocket2 As ServerSocket
ToastMessageShow("Ip address: " & ssocket2.GetMyIP,True)

but this only reports 192.0.0.4 when on cell network.

I want my client to be able to see his current IP address anytime without him having to do anything.
this is an service
 
Last edited:
Upvote 0

OliverA

Expert
Licensed User
Longtime User
but this only reports 192.0.0.4 when on cell network.
That might be your cell network IP. Many cell providers hand out private IP numbers and handle the NATing on the back end
 
Upvote 0

scottie

Member
Licensed User
Longtime User
Wow, After all that, I still get 192.0.0.4.
I even tried starting my program on cell network.
I disabled Netguard(which I hate to do) and started program.
My Client has Netguard too. (everyone should)
no change.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

scottie

Member
Licensed User
Longtime User
Thanks for your help. To keep code down, i just have the app connect to my server which reports IP address.
It was the simplest / low code way I could do. This way I also test for internet connectivity
-Scott
 
Upvote 0
Top