Android Question getBSSID

Philip Prins

Active Member
Licensed User
Longtime User
Is there a way to get the BSSID (Mac adress) of the Accespoint i am connected to?
I noticed the WiFi libraries based on scan results but i want a solution to retrieve it directly.

getBSSID
Added in API level 1
public String getBSSID ()

Return the basic service set identifier (BSSID) of the current access point.

The BSSID may be null, if there is no network currently connected. "02:00:00:00:00:00", if the caller has insufficient permissions to access the BSSID.

How to use this in B4A?

https://developer.android.com/reference/android/net/wifi/WifiInfo.html#getBSSID()
 

Philip Prins

Active Member
Licensed User
Longtime User
I think that you should use this library: https://www.b4x.com/android/forum/threads/wifi-library.8613/

I see that there is an isConnected property that you can use.
Thanks Erel,

Found it.
B4X:
    If reading.IsConnected = True Then
            
            
            BSSID = reading.BSSID
            SSID = reading.SSID
            
            
        
            If SSID.Contains("my-button") Then
                btnWrite.Visible = True
                
                BSSID = BSSID.ToUpperCase
                BSSID = BSSID.Replace(":","")
                Log(BSSID)
                Starter.kvs.Put("ButtonMAC",BSSID)
                ButtonMac = BSSID
                Else
                
                btnWrite.Visible = False
            End If
 
Upvote 0
Top