Freigeben über


WifiManager.DisableNetwork(Int32) Method

Definition

Disable a configured network.

[Android.Runtime.Register("disableNetwork", "(I)Z", "GetDisableNetwork_IHandler")]
public virtual bool DisableNetwork (int netId);
[<Android.Runtime.Register("disableNetwork", "(I)Z", "GetDisableNetwork_IHandler")>]
abstract member DisableNetwork : int -> bool
override this.DisableNetwork : int -> bool

Parameters

netId
Int32

the ID of the network as returned by #addNetwork or #getConfiguredNetworks.

Returns

true if the operation succeeded

Attributes

Remarks

Disable a configured network. The specified network will not be a candidate for associating. This may result in the asynchronous delivery of state change events.

Applications are not allowed to disable networks created by other applications.

This member is deprecated. a) See WifiNetworkSpecifier.Builder#build() for new mechanism to trigger connection to a Wi-Fi network. b) See #addNetworkSuggestions(List), #removeNetworkSuggestions(List) for new API to add Wi-Fi networks for consideration when auto-connecting to wifi. <b>Compatibility Note:</b> For applications targeting android.os.Build.VERSION_CODES#Q or above, this API will always fail and return false. <p> Deprecation Exemptions: <ul> <li>Device Owner (DO), Profile Owner (PO) and system apps. </ul>

Java documentation for android.net.wifi.WifiManager.disableNetwork(int).

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.

Applies to