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

MLwifi

Written by Jem Miller - Missing Link Software

List of types:

MLScan
MLwifi

MLScan


Events:

ScanDone(Results() As String, Count As Int)

Members:


  addAP (EntryNumber As Int, securityType As String, Password As String) As Boolean

  connectToAP (EntryNumber As Int) As Boolean

  Disconnect As Boolean

  forgetAP (NetId As Int) As Boolean

  getBSSID (EntryNumber As Int) As String

  isStored (EntryNumber As Int) As Boolean

  LinkSpeed As Int [read only]

  listSavedNetworks As java.util.List

  startScan (EventName As String)

  updateWifiList

  WifiCap (EntryNumber As Int) As String

  wifis() As String

Members description:

addAP (EntryNumber As Int, securityType As String, Password As String) As Boolean
Adds an entry to the wifi manager and connects to it. This method saves the configuration of the new entry onto the device. Use the forgetAP method to delete them.

EntryNumber - If you display the string array wifis or the array returned in the getWifiList method UNSORTED, you can pass the Position variable from your ListView_Click event.
Otherwise, you must pass the entry number from the string array since that is what is used as a reference.

securityType - The Access Point security type (returned in the scan result string array)

Password - The password/phrase for the wifi access point. Pass "" for an open network. Handles WEP HEX or text phrases

It is up to you to supply all information. The security type is found in the scan results array.

Returns True if the connection is successful
connectToAP (EntryNumber As Int) As Boolean
Connects to a network already configured on the device. The device will use saved values to connect.

EntryNumber - If you display the string array wifis or the array returned in the getWifiList method UNSORTED, you can pass the Position variable from your ListView_Click event.
Otherwise, you must pass the entry number from the string array since that is what is used as a reference.

Returns true if successful
Disconnect As Boolean
Disconnects the current wifi AP connection

Returns True on success
forgetAP (NetId As Int) As Boolean
Forgets (erases) a stored access point on the device.

NetId - The network ID number to forget (returned in the listSavedNetworks method)

Returns True if successful
getBSSID (EntryNumber As Int) As String
Returns the BSSID for the selected entry.

EntryNumber - If you display the string array wifis or the array returned in the getWifiList method UNSORTED, you can pass the Position variable from your ListView_Click event.
Otherwise, you must pass the entry number from the string array since that is what is used as a reference.
isStored (EntryNumber As Int) As Boolean
Checks the stored networks on the device to see if this entry is a previously saved access point

EntryNumber - The entry number in the wifis array to check. If you display the string array wifis or the array returned in the getWifiList method UNSORTED, you can pass the Position variable from your ListView_Click event.
Otherwise, you must pass the entry number from the string array since that is what is used as a reference.

Returns True if this is a stored network
LinkSpeed As Int [read only]
Returns the LinkSpeed of the connected wifi access point
listSavedNetworks As java.util.List
Builds a list of all saved networks on the device.

Returns a comma separated list of SSID's and their BSSID and network ID number.
startScan (EventName As String)
Initializes all objects and scans for wifi networks. Builds a string array of results (wifis) that can be accessed directly or with a call to updateWifiList.
THIS METHOD SHOULD ONLY BE CALLED ONCE!
updateWifiList
Call only after startScan has already been called and a string array of Access Points has been built. This method returns a string array containing the access points from the most recent scan, including background scans done automatically by the Android WifiManager. *

The initial list takes several seconds to build. Use a timer or other means to test if the result is > null.

Returns the string array of comma separated wifi access points by SSID. Each entry may contain the following:
SSID, Security type, Signal level (in DB's), and the word "Saved" if the network was previously saved for use on this device.
WifiCap (EntryNumber As Int) As String
Returns a String containing info about the entry. A startScan must have already been done. The string contains the SSID, the BSSID, and the capabilities of the network access point.
Each item is separated by a comma (SSID,BSSID,CapabilityString). The capabilities part can be quite long.

EntryNumber - If you display the string array wifis or the array returned in the getWifiList method UNSORTED, you can pass the Position variable from your ListView_Click event.
Otherwise, you must pass the entry number from the string array since that is what is used as a reference.

Returns a string of comma separated entries of SSID,BSSID, and capability string. Returns an empty string on error.
wifis() As String
A string array containing all scanned access points in the area of the device.
These are comma separated entries consisting of the following:

SSID, Security type, signal strength, and "Saved" if this network was previously saved for use on this device.

MLwifi


Permissions:

android.permission.ACCESS_NETWORK_STATE
android.permission.ACCESS_WIFI_STATE
android.permission.CHANGE_WIFI_STATE

Events:

None

Members:


  EnableWifi (Enabled As Boolean)

  IpAddress As String

  isOnLine As Boolean

  isWifiConnected As Boolean

  MACAddress As String

  SSID As String

  WifiSignal As Int

  WifiStrength As Int

Members description:

EnableWifi (Enabled As Boolean)
Turns wifi on or off

Pass True to enable wifi or False to disable.

Example
dim wifi as MLwifi

wifi.EnableWifi(true)
IpAddress As String
Get IP address from the wifi interface)

Returns address or empty string
isOnLine As Boolean
Checks for internet connection

This method does not check or care what type of network is used.
It can be wifi, 2g, 3g, 4g, wimax, etc. It just tests for internet connectivity.

Returns True if internet is available.
isWifiConnected As Boolean
Checks if wifi is connected. This only checks for wifi connection to a router.
It does NOT test for internet availability. Use isOnLine() for that.

Returns True if wifi is connected or False if 2g, 3g, 4g, wimax or no connection.
MACAddress As String
Returns MAC address of the current interface

Returns MAC address or empty string
SSID As String
Returns the current SSID
WifiSignal As Int
Returns the raw signal strength in decibels as an integer

Returns 0 on error
WifiStrength As Int
Returns an integer between 0 and 100 as a percentage of signal strength

Returns 0 on error.
Top