Share via


NetworkInfo Class

Definition

Describes the status of a network interface.

[Android.Runtime.Register("android/net/NetworkInfo", DoNotGenerateAcw=true)]
public class NetworkInfo : Java.Lang.Object, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/net/NetworkInfo", DoNotGenerateAcw=true)>]
type NetworkInfo = class
    inherit Object
    interface IParcelable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
NetworkInfo
Attributes
Implements

Remarks

Describes the status of a network interface.

Use ConnectivityManager#getActiveNetworkInfo() to get an instance that represents the current network connection.

This member is deprecated. Callers should instead use the ConnectivityManager.NetworkCallback API to learn about connectivity changes, or switch to use ConnectivityManager#getNetworkCapabilities or ConnectivityManager#getLinkProperties to get information synchronously. Keep in mind that while callbacks are guaranteed to be called for every event in order, synchronous calls have no such constraints, and as such it is unadvisable to use the synchronous methods inside the callbacks as they will often not offer a view of networking that is consistent (that is: they may return a past or a future state with respect to the event being processed by the callback). Instead, callers are advised to only use the arguments of the callbacks, possibly memorizing the specific bits of information they need to keep from one callback to another.

Java documentation for android.net.NetworkInfo.

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

NetworkInfo(Int32, Int32, String, String)

Create a new instance of NetworkInfo.

NetworkInfo(IntPtr, JniHandleOwnership)

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

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Creator
ExtraInfo

Report the extra information about the network state, if any was provided by the lower networking layers.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsAvailable

Indicates whether network connectivity is possible.

IsConnected

Indicates whether network connectivity exists and it is possible to establish connections and pass data.

IsConnectedOrConnecting

Indicates whether network connectivity exists or is in the process of being established.

IsFailover

Indicates whether the current attempt to connect to the network resulted from the ConnectivityManager trying to fail over to this network following a disconnect from another network.

IsRoaming

Indicates whether the device is currently roaming on this network.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
Reason

Report the reason an attempt to establish connectivity failed, if one is available.

Subtype

Return a network-type-specific integer describing the subtype of the network.

SubtypeName

Return a human-readable name describing the subtype of the network.

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.

Type

Reports the type of network to which the info in this NetworkInfo pertains.

TypeName

Return a human-readable name describe the type of the network, for example "WIFI" or "MOBILE".

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DescribeContents()
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

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

(Inherited from Object)
GetDetailedState()

Reports the current fine-grained state of the network.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetState()

Reports the current coarse-grained state of the network.

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)
SetDetailedState(NetworkInfo+DetailedState, String, String)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

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

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
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)
WriteToParcel(Parcel, ParcelableWriteFlags)

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 self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to