Android Question Is there a way to get connection status?

mitobobo

Member
Licensed User
Longtime User
Mauro, do you want to check Internet connection, is that correct?

B4X:
Dim Phone As Phone
Dim server As ServerSocket
If server.GetMyWifiIP == "127.0.0.1" Then ' IF WIFI IS NOT CONNECTED
If(Phone.GetDataState = = "DISCONNECTED" OR Phone.GetDataState == "SUSPENDED" OR Phone.IsAirplaneModeOn = = True) Then ' IF MOBILE DATA IS OFF
Log("No Internet connection")
Else ' IF MOBILE DATA IS ON
Log("Internet connection available")
End If
Else ' IF WIFI IS CONNECTED
Log("Wifi is ON")
End If

I hope this will help you.
Please let me know
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
Yes, as far as I remember. It comunicates the instant type of connection, coded as a string according phone's firmware or WIFI if it's connected on that network...
A single call haveNetworkType reports networktype
 

Attachments

  • networkstatus.zip
    2 KB · Views: 261
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…