Android Programming Press on the image to return to the main documentation page.

ABWifi

Written by Alain Bailleul

List of types:

ABFoundLocation
ABWifi
ABWifiInfo

ABFoundLocation

returns an ABFoundLocation object. This contains the Latitude and Longitude
found by using the Wifi signal and GSM Triangulation.

Events:

None

Members:


  Latitude As Double

  Longitude As Double

Members description:

Latitude As Double
Longitude As Double

ABWifi

This library allows you to get Wifi information.

Extra added is a location function
It uses the Wifi Signal and GSM Triangulation to get the latitude and longitude of the device
without an active GPS.
This is an 'Activity Object', it cannot be declared under Sub Process_Globals.

Permissions:

android.permission.ACCESS_WIFI_STATE
android.permission.CHANGE_WIFI_STATE
android.permission.INTERNET
android.permission.ACCESS_FINE_LOCATION

Events:

FoundLocation()

Members:


  ABGetCurrentWifiInfo As ABWifiInfo

  ABGetFoundLocation As ABFoundLocation

  ABGetLocation (eventName As String) As Boolean

  ABGetWifiNetwork (index As Integer) As ABWifiInfo

  ABLoadWifi As Boolean

  ABNumberOfAvailableWifiNetworks As Integer

  ABWifiLastError As String

Members description:

ABGetCurrentWifiInfo As ABWifiInfo
Returns the current connected ABWifiInfo after using the ABLoadWifi() function.

See ABLoadWifi() for an example.
ABGetFoundLocation As ABFoundLocation
returns the current ABFoundLocation by using the ABGetLocation() function.

see ABGetLocation() for an example.

ABGetLocation (eventName As String) As Boolean
Gets the current location of the device by using the Wifi signal
and GSM Triangulation

Example:

Sub Globals
Dim myWifi As ABWifi    
Dim Button1 As Button
End Sub

Sub Button1_Click
Dim r As Boolean
r = myWifi.ABGetLocation(
"myWifi")    
If r = False Then
     Msgbox (myWifi.ABWifiLastError(),
"")
End If
End Sub

Sub myWifi_FoundLocation ()
Dim ResLocation As ABFoundLocation
resLocation = myWifi.ABGetFoundLocation()
    Msgbox (
"" & ResLocation.Latitude & " - " & ResLocation.Longitude, "")
End Sub
ABGetWifiNetwork (index As Integer) As ABWifiInfo
Returns an ABWifiInfo object that are found by using the ABLoadWifi() function.

See ABLoadWifi() for an example.
ABLoadWifi As Boolean
Loads the Wifi information.

Example:

Sub Globals
Dim myWifi As ABWifi
Dim Button1 As Button
End Sub

Sub Button1_Click
Dim r As Boolean
Dim a As Int
r = myWifi.ABLoadWifi()
If r = True Then
     Msgbox (myWifi.ABGetCurrentWifiInfo().SSID,
"")
    
For a = 0 To myWifi.ABNumberOfAvailableWifiNetworks - 1
         Msgbox (myWifi.ABGetWifiNetwork(a).SSID &
" " & myWifi.ABGetWifiNetwork(a).Level, "")
    
Next
Else
Msgbox(myWifi.ABWifiLastError,
"")
End If
End Sub
ABNumberOfAvailableWifiNetworks As Integer
Returns the number of available Wifi Networks
ABWifiLastError As String
returns the last error message if any

Example:
If myWifi.ABWifiLastError <> "" Then
    Msgbox(myWifi.ABWifiLastError,
"")
Else
    Msgbox(
"everything ok", "")
End If

ABWifiInfo

Returns an ABWifiInfo Object.

Properties:
(Some properties are only filled for the connected Wifi, see ABGetCurrentWifiInfo())

BSSID (String)
MacAddress (String)
NetworkId (Integer)
Rssi (Integer)
SSID (String)
HiddenSSID (Boolean)
FullString (String)
Level (Integer)
IsConnected (Boolean)
Frequency (Integer)
Capabilities (String)
LinkSpeed (Integer)
State (String)

Events:

None

Members:


  BSSID As String

  Capabilities As String

  Frequency As Integer

  FullString As String

  HiddenSSID As Boolean

  IsConnected As Boolean

  Level As Integer

  LinkSpeed As Integer

  MacAddress As String

  NetworkId As Integer

  Rssi As Integer

  SSID As String

  State As String

Members description:

BSSID As String
Capabilities As String
Frequency As Integer
FullString As String
HiddenSSID As Boolean
IsConnected As Boolean
Level As Integer
LinkSpeed As Integer
MacAddress As String
NetworkId As Integer
Rssi As Integer
SSID As String
State As String

Top