Android Question Get name of SSID of WIFI

AUGUSTO CAVALEIRO

Member
Licensed User
Hello, I'm new to B4A and I wanted to get the SSID of the wifi network ... I found some of this code here ... but I can't get it to work ... can someone help me? Thanks in advance

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

    Dim R As Reflector
End Sub

Sub GetWIFIType As String
 
    'Requires Permission to be added with the Manifest Editor:
    '                         AddPermission (android.permission.ACCESS_NETWORK_STATE)
 
    R.Target=R.GetContext
    Try
        R.Target=r.RunMethod2("getSystemService","connectivity","java.lang.String")
        R.Target=R.RunMethod("getActiveNetworkInfo")
        R.Target=R.RunMethod("getTypeName")
        Return R.Target
    Catch
        Return "none"
    End Try
End Sub

 Sub GetWIFIName As String
 
    'Requires Permission to be added with the Manifest Editor:
    '                         AddPermission (android.permission.ACCESS_NETWORK_STATE)
 
    R.Target=R.GetContext
    Try
        R.Target=r.RunMethod2("getSystemService","wifi","java.lang.String")
        R.Target=R.RunMethod("getConnectionInfo")
        R.Target=R.RunMethod("getSSID")
        Return R.Target
    Catch
        Return "none"
    End Try
End Sub
 

DonManfred

Expert
Licensed User
Longtime User

This includes the SSID too i fear.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…