Partager via


WifiManager Class

Definition

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

[Android.Runtime.Register("android/net/wifi/WifiManager", DoNotGenerateAcw=true)]
public class WifiManager : Java.Lang.Object
[<Android.Runtime.Register("android/net/wifi/WifiManager", DoNotGenerateAcw=true)>]
type WifiManager = class
    inherit Object
Inheritance
WifiManager
Attributes

Remarks

Android platform documentation

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

WifiManager(IntPtr, JniHandleOwnership)

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

Fields

ActionPickWifiNetwork

Activity Action: Pick a Wi-Fi network to connect to.

ActionRemoveSuggestionDisconnect
ActionRemoveSuggestionLinger
ActionRequestScanAlwaysAvailable

Activity Action: Show a system activity that allows the user to enable scans to be available even with Wi-Fi turned off.

ActionWifiNetworkSuggestionPostConnection
ActionWifiScanAvailabilityChanged
ChannelDataKeyFrequencyMhz
ChannelDataKeyNumAp
ErrorAuthenticating

The error code if there was a problem authenticating.

ExtraBssid

The lookup key for a String giving the BSSID of the access point to which we are connected.

ExtraNetworkInfo

The lookup key for a NetworkInfo object associated with the Wi-Fi network.

ExtraNetworkSuggestion
ExtraNewRssi

The lookup key for an int giving the new RSSI in dBm.

ExtraNewState

The lookup key for a SupplicantState describing the new state Retrieve with GetParcelableExtra(String).

ExtraPreviousWifiState

The previous Wi-Fi state.

ExtraResultsUpdated
ExtraScanAvailable
ExtraSupplicantConnected

The lookup key for a boolean that indicates whether a connection to the supplicant daemon has been gained or lost.

ExtraSupplicantError

The lookup key for a SupplicantState describing the supplicant error code if any Retrieve with GetIntExtra(String, Int32).

ExtraWifiInfo

The lookup key for a WifiInfo object giving the information about the access point to which we are connected.

ExtraWifiState

The lookup key for an int that indicates whether Wi-Fi is enabled, disabled, enabling, disabling, or unknown.

NetworkIdsChangedAction

The network IDs of the configured networks could have changed.

NetworkStateChangedAction

Broadcast intent action indicating that the state of Wi-Fi connectivity has changed.

RssiChangedAction

The RSSI (signal strength) has changed.

ScanResultsAvailableAction

An access point scan has completed, and results are available from the supplicant.

StatusLocalOnlyConnectionFailureAssociation
StatusLocalOnlyConnectionFailureAuthentication
StatusLocalOnlyConnectionFailureIpProvisioning
StatusLocalOnlyConnectionFailureNoResponse
StatusLocalOnlyConnectionFailureNotFound
StatusLocalOnlyConnectionFailureUnknown
StatusNetworkSuggestionsErrorAddDuplicate
StatusNetworkSuggestionsErrorAddExceedsMaxPerApp
StatusNetworkSuggestionsErrorAddInvalid
StatusNetworkSuggestionsErrorAddNotAllowed
StatusNetworkSuggestionsErrorAppDisallowed
StatusNetworkSuggestionsErrorInternal
StatusNetworkSuggestionsErrorRemoveInvalid
StatusNetworkSuggestionsErrorRestrictedByAdmin
StatusNetworkSuggestionsSuccess
StatusSuggestionApprovalApprovedByCarrierPrivilege
StatusSuggestionApprovalApprovedByUser
StatusSuggestionApprovalPending
StatusSuggestionApprovalRejectedByUser
StatusSuggestionApprovalUnknown
StatusSuggestionConnectionFailureAssociation
StatusSuggestionConnectionFailureAuthentication
StatusSuggestionConnectionFailureIpProvisioning
StatusSuggestionConnectionFailureUnknown
SupplicantConnectionChangeAction

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.

SupplicantStateChangedAction

Broadcast intent action indicating that the state of establishing a connection to an access point has changed.

UnknownSsid
WifiInterfaceTypeAp
WifiInterfaceTypeAware
WifiInterfaceTypeDirect
WifiInterfaceTypeSta
WifiMultiInternetModeDbsAp
WifiMultiInternetModeDisabled
WifiMultiInternetModeMultiAp
WifiStateChangedAction

Broadcast intent action indicating that Wi-Fi has been enabled, disabled, enabling, disabling, or unknown.

Properties

CallerConfiguredNetworks
Class

Returns the runtime class of this Object.

(Inherited from Object)
ConfiguredNetworks

Return a list of all the networks configured in the supplicant.

ConnectionInfo

Return dynamic information about the current Wi-Fi connection, if any is active.

DhcpInfo

Return the DHCP-assigned addresses from the last successful DHCP request, if any.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsAutoWakeupEnabled
IsBridgedApConcurrencySupported
IsDecoratedIdentitySupported
IsDeviceToApRttSupported
IsDualBandSimultaneousSupported
IsEasyConnectDppAkmSupported
IsEasyConnectEnrolleeResponderModeSupported
IsEasyConnectSupported
IsEnhancedOpenSupported
IsEnhancedPowerReportingSupported
IsMakeBeforeBreakWifiSwitchingSupported
IsP2pSupported
IsPasspointTermsAndConditionsSupported
IsPreferredNetworkOffloadSupported
IsScanAlwaysAvailable

Check if scanning is always available.

IsScanThrottleEnabled
IsStaApConcurrencySupported
IsStaBridgedApConcurrencySupported
IsStaConcurrencyForLocalOnlyConnectionsSupported
IsStaConcurrencyForMultiInternetSupported
IsTdlsSupported
IsTidToLinkMappingNegotiationSupported
IsTlsMinimumVersionSupported
IsTlsV13Supported
IsTrustOnFirstUseSupported
IsWapiSupported
IsWifiDisplayR2Supported
IsWifiEnabled

Return whether Wi-Fi is enabled or disabled.

IsWifiPasspointEnabled
IsWpa3SaeH2eSupported
IsWpa3SaePublicKeySupported
IsWpa3SaeSupported
IsWpa3SuiteBSupported
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
MaxNumberOfChannelsPerNetworkSpecifierRequest
MaxNumberOfNetworkSuggestionsPerApp
MaxSignalLevel
NetworkSuggestions
PasspointConfigurations
PeerReference (Inherited from Object)
ScanResults

Return the results of the latest access point scan.

StaConcurrencyForMultiInternetMode
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

WifiState

Gets the Wi-Fi enabled state.

Methods

AddLocalOnlyConnectionFailureListener(IExecutor, WifiManager+ILocalOnlyConnectionFailureListener)
AddNetwork(WifiConfiguration)

Add a new network description to the set of configured networks.

AddNetworkPrivileged(WifiConfiguration)
AddNetworkSuggestions(IList<WifiNetworkSuggestion>)
AddOrUpdatePasspointConfiguration(PasspointConfiguration)
AddSuggestionConnectionStatusListener(IExecutor, WifiManager+ISuggestionConnectionStatusListener)
AddSuggestionUserApprovalStatusListener(IExecutor, WifiManager+ISuggestionUserApprovalStatusListener)
AllowAutojoinGlobal(Boolean)
CalculateSignalLevel(Int32, Int32)

Calculates the level of the signal.

CalculateSignalLevel(Int32)
CancelWps(WifiManager+WpsCallback)

Cancel any ongoing Wi-fi Protected Setup

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
CompareSignalLevel(Int32, Int32)

Compares two signal strengths.

CreateMulticastLock(String)

Create a new MulticastLock

CreateWifiLock(String)

Creates a new WifiLock.

CreateWifiLock(WifiMode, String)

Creates a new WifiLock.

DisableNetwork(Int32)

Disable a configured network.

Disconnect()

Disassociate from the currently active access point.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
EnableNetwork(Int32, Boolean)

Allow a previously configured network to be associated with.

Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
FlushPasspointAnqpCache()
FromContext(Context)
GetAllowedChannels(WifiBand, WifiAvailableChannelModes)
GetChannelData(IExecutor, IConsumer)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetMaxSupportedConcurrentTdlsSessions(IExecutor, IConsumer)
GetNumberOfEnabledTdlsSessions(IExecutor, IConsumer)
GetUsableChannels(WifiBand, WifiAvailableChannelModes)
Is24GHzBandSupported()
Is5GHzBandSupported()
Is60GHzBandSupported()
Is6GHzBandSupported()
IsCarrierNetworkOffloadEnabled(Int32, Boolean)
IsTdlsOperationCurrentlyAvailable(IExecutor, IConsumer)
IsWifiStandardSupported(Int32)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
PingSupplicant()

Check that the supplicant daemon is responding to requests.

QueryAutojoinGlobal(IExecutor, IConsumer)
Reassociate()

Reconnect to the currently active access point, even if we are already connected.

Reconnect()

Reconnect to the currently active access point, if we are currently disconnected.

RegisterScanResultsCallback(IExecutor, WifiManager+ScanResultsCallback)
RegisterSubsystemRestartTrackingCallback(IExecutor, WifiManager+SubsystemRestartTrackingCallback)
RemoveLocalOnlyConnectionFailureListener(WifiManager+ILocalOnlyConnectionFailureListener)
RemoveNetwork(Int32)

Remove the specified network from the list of configured networks.

RemoveNetworkSuggestions(IList<WifiNetworkSuggestion>, Int32)
RemoveNetworkSuggestions(IList<WifiNetworkSuggestion>)
RemoveNonCallerConfiguredNetworks()
RemovePasspointConfiguration(String)
RemoveSuggestionConnectionStatusListener(WifiManager+ISuggestionConnectionStatusListener)
RemoveSuggestionUserApprovalStatusListener(WifiManager+ISuggestionUserApprovalStatusListener)
ReportCreateInterfaceImpact(Int32, Boolean, IExecutor, IBiConsumer)
SaveConfiguration()

Tell the supplicant to persist the current list of configured networks.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetTdlsEnabled(InetAddress, Boolean, IExecutor, IConsumer)
SetTdlsEnabled(InetAddress, Boolean)

Enable/Disable TDLS on a specific local route.

SetTdlsEnabledWithMacAddress(String, Boolean, IExecutor, IConsumer)
SetTdlsEnabledWithMacAddress(String, Boolean)

Similar to SetTdlsEnabled(InetAddress, Boolean), except this version allows you to specify remote endpoint with a MAC address.

SetWifiEnabled(Boolean)

Enable or disable Wi-Fi.

StartLocalOnlyHotspot(WifiManager+LocalOnlyHotspotCallback, Handler)
StartScan()

Request a scan for access points.

StartWps(WpsInfo, WifiManager+WpsCallback)

Start Wi-fi Protected Setup

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
UnregisterScanResultsCallback(WifiManager+ScanResultsCallback)
UnregisterSubsystemRestartTrackingCallback(WifiManager+SubsystemRestartTrackingCallback)
UpdateNetwork(WifiConfiguration)

Update the network description of an existing configured network.

ValidateSoftApConfiguration(SoftApConfiguration)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to