Android Question [solved] Online Status

MarkusR

Well-Known Member
Licensed User
Longtime User
hello,
is there an easy way to get system info if the device have wlan or is online?
 

Peter Simpson

Expert
Licensed User
Longtime User
I personally sometimes use Ping or The updated MLWiFi library (it's developed by another developer now). Don't forget to add RunTimePermissions...
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
yes, maybe i will use network lib or okhttpsutils2, just to check if my web server is accessible.
me looked-for a lib (optimal) came with ide to read this state.
android.permission.ACCESS_WIFI_STATE
android.permission.ACCESS_NETWORK_STATE
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
Phone library...
thanks, i will try ConnectivityChanged event :)

Starter
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

    Public PhoneEvent1 As PhoneEvents

End Sub

Sub Service_Create
    'This is the program entry point.
    'This is a good place to load resources that are not specific to a single activity.

    'https://www.b4x.com/android/help/phone.html#phoneevents
    PhoneEvent1.Initialize("PhoneEvent")

End Sub

Sub PhoneEvent_ConnectivityChanged(NetworkType As String, State As String, Intent As Intent)
        
    If State = "CONNECTED" Then
    Else
        ToastMessageShow("Keine Netzwerkverbindung",True)
        Log(NetworkType)
        Log(State)
                
    End If
    
End Sub
 
Last edited:
Upvote 0
Top