ConnectivityManager Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Class that answers queries about the state of network connectivity.
[Android.Runtime.Register("android/net/ConnectivityManager", DoNotGenerateAcw=true)]
public class ConnectivityManager : Java.Lang.Object
[<Android.Runtime.Register("android/net/ConnectivityManager", DoNotGenerateAcw=true)>]
type ConnectivityManager = class
inherit Object
- Inheritance
- Attributes
Remarks
Class that answers queries about the state of network connectivity. It also notifies applications when network connectivity changes.
The primary responsibilities of this class are to: <ol> <li>Monitor network connections (Wi-Fi, GPRS, UMTS, etc.)</li> <li>Send broadcast intents when network connectivity changes</li> <li>Attempt to "fail over" to another network when connectivity to a network is lost</li> <li>Provide an API that allows applications to query the coarse-grained or fine-grained state of the available networks</li> <li>Provide an API that allows applications to request and select networks for their data traffic</li> </ol>
Java documentation for android.net.ConnectivityManager
.
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
ConnectivityManager(IntPtr, JniHandleOwnership) |
A constructor used when creating managed representations of JNI objects; called by the runtime. |
Fields
ActionBackgroundDataSettingChanged |
Obsolete.
Broadcast Action: The setting for background data usage has changed values. |
ActionCaptivePortalSignIn |
The device has connected to a network that has presented a captive portal, which is blocking Internet connectivity. |
ActionRestrictBackgroundChanged |
A change in the background metered network activity restriction has occurred. |
ConnectivityAction |
A change in network connectivity has occurred. |
DefaultNetworkPreference |
Obsolete.
If you want to set the default network preference,you can directly change the networkAttributes array in framework's config. |
ExtraCaptivePortal |
The lookup key for a |
ExtraCaptivePortalUrl |
Key for passing a URL to the captive portal login activity. |
ExtraExtraInfo |
The lookup key for a string that provides optionally supplied extra information about the network state. |
ExtraIsFailover |
The lookup key for a boolean that indicates whether a connect event is for a network to which the connectivity manager was failing over following a disconnect on another network. |
ExtraNetwork |
The lookup key for a |
ExtraNetworkInfo |
Obsolete.
The lookup key for a |
ExtraNetworkRequest |
The lookup key for a |
ExtraNetworkType |
Network type which triggered a |
ExtraNoConnectivity |
The lookup key for a boolean that indicates whether there is a complete lack of connectivity, i. |
ExtraOtherNetworkInfo |
The lookup key for a |
ExtraReason |
The lookup key for a string that indicates why an attempt to connect to a network failed. |
RestrictBackgroundStatusDisabled |
Obsolete.
Device is not restricting metered network activity while application is running on background. |
RestrictBackgroundStatusEnabled |
Obsolete.
Device is restricting metered network activity while application is running on background. |
RestrictBackgroundStatusWhitelisted |
Obsolete.
Device is restricting metered network activity while application is running on background, but application is allowed to bypass it. |
Properties
ActiveNetwork |
Returns a |
ActiveNetworkInfo |
Returns details about the currently active default data network. |
BackgroundDataSetting |
Obsolete.
Returns the value of the setting for background data usage. |
BoundNetworkForProcess |
Returns the |
Class |
Returns the runtime class of this |
DefaultProxy |
Get the current default HTTP proxy settings. |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
IsActiveNetworkMetered |
Returns if the currently active data network is metered. |
IsDefaultNetworkActive |
Return whether the data network is currently active. |
JniIdentityHashCode | (Inherited from Object) |
JniPeerMembers | |
NetworkPreference |
Obsolete.
Retrieves the current preferred network type. -or- Specifies the preferred network type. |
PeerReference | (Inherited from Object) |
ProcessDefaultNetwork |
Returns the |
RestrictBackgroundStatus |
Determines if the calling application is subject to metered network restrictions while running on background. |
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. |
Methods
AddDefaultNetworkActiveListener(ConnectivityManager+IOnNetworkActiveListener) |
Start listening to reports when the system's default data network is active, meaning it is a good time to perform network traffic. |
BindProcessToNetwork(Network) |
Binds the current process to |
Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
CreateSocketKeepalive(Network, IpSecManager+UdpEncapsulationSocket, InetAddress, InetAddress, IExecutor, SocketKeepalive+Callback) | |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
FromContext(Context) | |
GetAllNetworkInfo() |
Returns connection status information about all network types supported by the device. |
GetAllNetworks() |
Returns an array of all |
GetConnectionOwnerUid(Int32, InetSocketAddress, InetSocketAddress) |
Returns the |
GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
GetLinkProperties(Network) |
Get the |
GetMultipathPreference(Network) |
Provides a hint to the calling application on whether it is desirable to use the multinetwork APIs (e. |
GetNetworkCapabilities(Network) |
Get the |
GetNetworkInfo(ConnectivityType) |
Returns connection status information about a particular network type. |
GetNetworkInfo(Network) |
Returns connection status information about a particular Network. |
GetNetworkWatchlistConfigHash() |
The network watchlist is a list of domains and IP addresses that are associated with potentially harmful apps. |
IsNetworkTypeValid(ConnectivityType) |
Tests if a given integer represents a valid network type. |
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) |
RegisterBestMatchingNetworkCallback(NetworkRequest, ConnectivityManager+NetworkCallback, Handler) | |
RegisterDefaultNetworkCallback(ConnectivityManager+NetworkCallback, Handler) | |
RegisterDefaultNetworkCallback(ConnectivityManager+NetworkCallback) | |
RegisterNetworkCallback(NetworkRequest, ConnectivityManager+NetworkCallback, Handler) | |
RegisterNetworkCallback(NetworkRequest, ConnectivityManager+NetworkCallback) |
Registers to receive notifications about all networks which satisfy the given NetworkRequest. |
RegisterNetworkCallback(NetworkRequest, PendingIntent) |
Registers a PendingIntent to be sent when a network is available which satisfies the given
|
ReleaseNetworkRequest(PendingIntent) |
Removes a request made via |
RemoveDefaultNetworkActiveListener(ConnectivityManager+IOnNetworkActiveListener) |
Remove network active listener previously registered with M:Android.Net.ConnectivityManager.AddDefaultNetworkActiveListener(.IOnNetworkActiveListener). |
ReportBadNetwork(Network) |
Report a problem network to the framework. |
ReportNetworkConnectivity(Network, Boolean) |
Report to the framework whether a network has working connectivity. |
RequestBandwidthUpdate(Network) |
Requests bandwidth update for a given |
RequestNetwork(NetworkRequest, ConnectivityManager+NetworkCallback, Handler, Int32) | |
RequestNetwork(NetworkRequest, ConnectivityManager+NetworkCallback, Handler) | |
RequestNetwork(NetworkRequest, ConnectivityManager+NetworkCallback, Int32) | |
RequestNetwork(NetworkRequest, ConnectivityManager+NetworkCallback) |
Request a network to satisfy a set of NetworkCapabilities. |
RequestNetwork(NetworkRequest, PendingIntent) |
Request a network to satisfy a set of |
RequestRouteToHost(ConnectivityType, Int32) |
Obsolete.
Ensure that a network route exists to deliver traffic to the specified host via the specified network interface. |
RequestRouteToHostAsync(ConnectivityType, Int32) | |
SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
SetProcessDefaultNetwork(Network) |
Binds the current process to |
StartUsingNetworkFeature(ConnectivityType, String) |
Obsolete.
Tells the underlying networking system that the caller wants to begin using the named feature. |
StopUsingNetworkFeature(ConnectivityType, String) |
Obsolete.
Tells the underlying networking system that the caller is finished using the named feature. |
ToArray<T>() | (Inherited from Object) |
ToString() |
Returns a string representation of the object. (Inherited from Object) |
UnregisterFromRuntime() | (Inherited from Object) |
UnregisterNetworkCallback(ConnectivityManager+NetworkCallback) |
Unregisters callbacks about and possibly releases networks originating from RequestNetwork(NetworkRequest, ConnectivityManager+NetworkCallback) and RegisterNetworkCallback(NetworkRequest, PendingIntent) calls. |
UnregisterNetworkCallback(PendingIntent) |
Unregisters a callback previously registered via
|
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) |
Events
DefaultNetworkActive |
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) |
Gets the JNI name of the type of the instance |
JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |