Android Question [solved] Online Status

Discussion in 'Android Questions' started by MarkusR, Apr 9, 2018.

  1. MarkusR

    MarkusR Well-Known Member Licensed User

    hello,
    is there an easy way to get system info if the device have wlan or is online?
     
  2. Peter Simpson

    Peter Simpson Expert Licensed User

    I personally sometimes use Ping or The updated MLWiFi library (it's developed by another developer now). Don't forget to add RunTimePermissions...
     
    MarkusR likes this.
  3. MarkusR

    MarkusR Well-Known Member Licensed 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
     
  4. DonManfred

    DonManfred Expert Licensed User

    MarkusR likes this.
  5. MarkusR

    MarkusR Well-Known Member Licensed User

    thanks, i will try ConnectivityChanged event :)

    Starter
    Code:
    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 StringIntent As Intent)
            
        
    If State = "CONNECTED" Then
        
    Else
            
    ToastMessageShow("Keine Netzwerkverbindung",True)
            
    Log(NetworkType)
            
    Log(State)
                    
        
    End If
        
    End Sub
     
    Last edited: Apr 9, 2018
    davelew1s likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice