Hi all,
with this code I want to get the connected SSID name under Android 8.1. This should be my router because the app is installed over B4A bridge.
The msgbox shows:
<unknown ssid>
COMPLETED
In the Documentation for Wifimanager is:
An app must hold ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in order to get valid results.
I granted the permission ACCESS_COARSE_LOCATION.
Has anyone an idea?
Lutz
with this code I want to get the connected SSID name under Android 8.1. This should be my router because the app is installed over B4A bridge.
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim Wifi As JavaObject
Dim context As JavaObject
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_COARSE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
context.InitializeContext
Wifi = context.RunMethod("getSystemService", Array("wifi"))
Dim SSID, state As String
Dim jo As JavaObject
jo = Wifi.RunMethodJO("getConnectionInfo", Null)
state = jo.RunMethod("getSupplicantState", Null)
If state = "COMPLETED" Then
SSID = jo.RunMethod("getSSID", Null)
Msgbox(state, SSID)
Else
Msgbox("Not COMPLETED", "state")
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Activity_PermissionResult (Permission As String, Result As Boolean)
End Sub
The msgbox shows:
<unknown ssid>
COMPLETED
In the Documentation for Wifimanager is:
An app must hold ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in order to get valid results.
I granted the permission ACCESS_COARSE_LOCATION.
Has anyone an idea?
Lutz