Android Guides | Samples

Android.Net.Wifi.WifiManager Class

This class provides the primary API for managing all aspects of Wi-Fi connectivity.

See Also: WifiManager

Syntax

[Android.Runtime.Register("android/net/wifi/WifiManager", DoNotGenerateAcw=true)]
public class WifiManager : Object

Remarks

This class provides the primary API for managing all aspects of Wi-Fi connectivity. Get an instance of this class by calling Context.GetSystemService(String). It deals with several categories of items:

  • The list of configured networks. The list can be viewed and updated, and attributes of individual entries can be modified.
  • The currently active Wi-Fi network, if any. Connectivity can be established or torn down, and dynamic information about the state of the network can be queried.
  • Results of access point scans, containing enough information to make decisions about what access point to connect to.
  • It defines the names of various Intent actions that are broadcast upon any sort of change in Wi-Fi state.
This is the API to use when performing Wi-Fi specific operations. To perform operations that pertain to network connectivity at an abstract level, use ConnectivityManager.

[Android Documentation]

Requirements

Namespace: Android.Net.Wifi
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Net.Wifi.WifiManager are listed below.

See Also: Object

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Fields

const
ActionPickWifiNetworkString. Activity Action: Pick a Wi-Fi network to connect to.
const
ActionRequestScanAlwaysAvailableString. Activity Action: Show a system activity that allows the user to enable scans to be available even with Wi-Fi turned off.
const
ErrorAuthenticatingInt32 (1). The error code if there was a problem authenticating.
const
ExtraBssidString. The lookup key for a String giving the BSSID of the access point to which we are connected.
const
ExtraNetworkInfoString. The lookup key for a NetworkInfo object associated with the Wi-Fi network.
const
ExtraNewRssiString. The lookup key for an int giving the new RSSI in dBm.
const
ExtraNewStateString. The lookup key for a SupplicantState describing the new state Retrieve with Intent.GetParcelableExtra(String).
const
ExtraPreviousWifiStateString. The previous Wi-Fi state.
const
ExtraSupplicantConnectedString. The lookup key for a boolean that indicates whether a connection to the supplicant daemon has been gained or lost.
const
ExtraSupplicantErrorString. The lookup key for a SupplicantState describing the supplicant error code if any Retrieve with Intent.GetIntExtra(String,Int32).
const
ExtraWifiInfoString. The lookup key for a WifiInfo object giving the information about the access point to which we are connected.
const
ExtraWifiStateString. The lookup key for an int that indicates whether Wi-Fi is enabled, disabled, enabling, disabling, or unknown.
const
NetworkIdsChangedActionString. The network IDs of the configured networks could have changed.
const
NetworkStateChangedActionString. Broadcast intent action indicating that the state of Wi-Fi connectivity has changed.
const
RssiChangedActionString. The RSSI (signal strength) has changed.
const
ScanResultsAvailableActionString. An access point scan has completed, and results are available from the supplicant.
const
SupplicantConnectionChangeActionString. Broadcast intent action indicating that a connection to the supplicant has been established (and it is now possible to perform Wi-Fi operations) or the connection to the supplicant has been lost.
const
SupplicantStateChangedActionString. Broadcast intent action indicating that the state of establishing a connection to an access point has changed.
const
WifiStateChangedActionString. Broadcast intent action indicating that Wi-Fi has been enabled, disabled, enabling, disabling, or unknown.

Public Properties

[read-only]
ConfiguredNetworksIList<WifiConfiguration>. Return a list of all the networks configured in the supplicant.
[read-only]
ConnectionInfoWifiInfo. Return dynamic information about the current Wi-Fi connection, if any is active.
[read-only]
DhcpInfoDhcpInfo. Return the DHCP-assigned addresses from the last successful DHCP request, if any.
[read-only]
IsDeviceToApRttSupportedBoolean.
[read-only]
IsEnhancedPowerReportingSupportedBoolean.
[read-only]
IsP2pSupportedBoolean.
[read-only]
IsPreferredNetworkOffloadSupportedBoolean.
[read-only]
IsScanAlwaysAvailableBoolean. Check if scanning is always available.
[read-only]
IsTdlsSupportedBoolean.
[read-only]
IsWifiEnabledBoolean. Return whether Wi-Fi is enabled or disabled.
[read-only]
ScanResultsIList<ScanResult>. Return the results of the latest access point scan.
[read-only]
WifiStateWifiState. Gets the Wi-Fi enabled state.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

AddNetwork(WifiConfiguration) : Int32
Add a new network description to the set of configured networks.
static
CalculateSignalLevel(Int32, Int32) : Int32
Calculates the level of the signal.
CancelWps(WifiManager+WpsCallback)
Cancel any ongoing Wi-fi Protected Setup
static
CompareSignalLevel(Int32, Int32) : Int32
Compares two signal strengths.
CreateMulticastLock(String) : WifiManager+MulticastLock
Create a new MulticastLock
CreateWifiLock(String) : WifiManager+WifiLock
Creates a new WifiLock.
CreateWifiLock(WifiMode, String) : WifiManager+WifiLock
Creates a new WifiLock.
DisableNetwork(Int32) : Boolean
Disable a configured network.
Disconnect() : Boolean
Disassociate from the currently active access point.
EnableNetwork(Int32, Boolean) : Boolean
Allow a previously configured network to be associated with.
static
FromContext(Context) : WifiManager
Is5GHzBandSupported() : Boolean
PingSupplicant() : Boolean
Check that the supplicant daemon is responding to requests.
Reassociate() : Boolean
Reconnect to the currently active access point, even if we are already connected.
Reconnect() : Boolean
Reconnect to the currently active access point, if we are currently disconnected.
RemoveNetwork(Int32) : Boolean
Remove the specified network from the list of configured networks.
SaveConfiguration() : Boolean
Tell the supplicant to persist the current list of configured networks.
SetTdlsEnabled(InetAddress, Boolean)
Enable/Disable TDLS on a specific local route.
SetTdlsEnabledWithMacAddress(String, Boolean)
Similar to WifiManager.SetTdlsEnabled(InetAddress,Boolean), except this version allows you to specify remote endpoint with a MAC address.
SetWifiEnabled(Boolean) : Boolean
Enable or disable Wi-Fi.
StartScan() : Boolean
Request a scan for access points.
StartWps(WpsInfo, WifiManager+WpsCallback)
Start Wi-fi Protected Setup
UpdateNetwork(WifiConfiguration) : Int32
Update the network description of an existing configured network.