Android Question B4A not showing SSID

Similar threads

B4A Code Snippet Access Wifi Information
B4A Code Snippet Start Local Hotspot
B4A Library Simple WIFI library
B4A Library MLwifi Library Updated to v4.00
B4A Question How does MLWifi actually work?

Nitin Joshi

Active Member
Licensed User
Hi,
My project is showing SSID <unknown SSID>. Can anyone help to know the reason?

I have attached the project for the reference.

/Code


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 MLwifi
'Dim WiFiScan As MLScan
Public myTempIP, mySSID, myPassword As String
Private rp As RuntimePermissions
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.
Private Label1 As Label
Private Label2 As Label
Private Label3 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
'WiFi.
'Do not forget to load the layout file created with the visual designer. For example:
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)

If FirstTime Then
' pscal
'connectionSuccess=False
Activity.LoadLayout ("Home_Screen")
mySSID=WiFi.WifiSSID
'UDPData_Send("","")
Sleep(1000)
Label1.Text=mySSID
If WiFi.isWifiConnected And WiFi.WifiSSID="Mumbai Indians" Then
Label3.Text="Condition matched"
Else
Label3.Text="Condition not matched"
End If

'Connect_Device
End If
End Sub

/Code end
 

Attachments

Nitin Joshi

Active Member
Licensed User
Dear, Thanks for educating me....

I found that location must be ON to show the SSID. However, can we get SSID keeping location OFF? or its must to keep location ON?
 

thetahsk

Active Member
Licensed User
from
https://developer.android.com/about/versions/pie/android-9.0-changes-all

Restricted access to Wi-Fi location and connection information

In Android 9, the permission requirements for an app to perform Wi-Fi scans are more strict than in previous versions. For details, see Wi-Fi scanning restrictions.

Similar restrictions also apply to the getConnectionInfo() method, which returns a WifiInfo object describing the current Wi-Fi connection. You can only use this object's methods to retrieve SSID and BSSID values if the calling app has the following permissions:

  • ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
  • ACCESS_WIFI_STATE
Retrieving the SSID or BSSID also requires location services to be enabled on the device (under Settings > Location).

Information removed from Wi-Fi service methods
In Android 9, the following events and broadcasts don't receive information about the user's location or personally identifiable data:

The NETWORK_STATE_CHANGED_ACTION system broadcast from Wi-Fi no longer contains SSID (previously EXTRA_SSID), BSSID (previously EXTRA_BSSID), or connection information (previously EXTRA_NETWORK_INFO). If your app needs this information, call getConnectionInfo() instead.

 
Top