Android Question B4A not showing SSID

Discussion in 'Android Questions' started by Nitin Joshi, Feb 10, 2019.

  1. Nitin Joshi

    Nitin Joshi 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
     

    Attached Files:

  2. DonManfred

    DonManfred Expert Licensed User

    1. You got told a few times to use code tags when posting code.
    Please do it.
    Please use [CODE]code here...[/CODE] tags when posting code.

    [​IMG]
    [​IMG]
    [​IMG]

    2. Use the forumsearch. This issue is handled a few times.
     
  3. Nitin Joshi

    Nitin Joshi 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?
     
  4. DonManfred

    DonManfred Expert Licensed User

    It must be on in newer Androids.
     
  5. Nitin Joshi

    Nitin Joshi Member Licensed User

    My question is....Is it mandatory to keep Location ON from Android 9 version? or there is way we can get SSID although if we keep location OFF.
     
  6. thetahsk

    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.

     
    simplypats likes this.
  7. DonManfred

    DonManfred Expert Licensed User

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