Android Question How do I detect if 4G is active

davepamn

Active Member
Licensed User
Longtime User
When I turn on 4G and wifi off, I need a way to detect, if a network connection is available.

I need to know the 4G IP address

This seems like an universal need for any synching between the local device database and a server.

Sub Class_Globals
Dim myLan as serversocket
end sub

Sub PingServer as boolean
dim oPhone as phone

if oPhone.IsAirplaneModeOn=True then
bRetVal=false
return(bRetVal)
end if
dim sDeviceIP as string
sDeviceIP=myLan.GetMyWifiIP
if sDeviceIP="127.0.0.1" then
bRetVal=false
return(bRetVal)
end if
if oPhone.GetSettings("wifi_on")<>1 then
bretval=false
return(bRetVal)
end if
if oPhone.GetDataState="DSCONNECTED" then
bRetVal=True
else
bRetVal=false
end if
return(bRetVal)
end sub

 

sirjo66

Well-Known Member
Licensed User
Longtime User
Yes
if GetMyIP = "127.0.01" isn't connect, if GetMyIP <> "127.0.0.1" is connect !!
Sergio
 
Upvote 0

davepamn

Active Member
Licensed User
Longtime User
Why not create us a simple, Ping API, to test if the server is available to use? The httpjob requires a callback function which is difficult to use when encapsulated in a class and function call from an invoking interface
 
Upvote 0
Top