Android Question Witch connection is used

makis_best

Well-Known Member
Licensed User
Longtime User
Hello

Is there any way to know if user use wifi connection or 4G connection?

Thank you.
 

mc73

Well-Known Member
Licensed User
Longtime User
I usually do it this way, though I'm not sure if it's the best:
B4X:
Dim srv As ServerSocket
srv.Initialize(0,"")
If srv.GetMyWifiIP = "127.0.0.1" Then
   log("not connected to WIFI")
end if
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
This is for WiFi. When we're not connected to WiFi, I send a request to a stable link (up, most of the time at least) for e.g. google.com. If I get a success, I assume we are connected using our 4G.
 
Upvote 0
Top