다음을 통해 공유


NetworkInfo.IsConnected Property

Definition

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

public virtual bool IsConnected { [Android.Runtime.Register("isConnected", "()Z", "GetIsConnectedHandler")] get; }
[<get: Android.Runtime.Register("isConnected", "()Z", "GetIsConnectedHandler")>]
member this.IsConnected : bool

Property Value

true if network connectivity exists, false otherwise.

Attributes

Remarks

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

Always call this before attempting to perform data transactions.

This member is deprecated. Apps should instead use the android.net.ConnectivityManager.NetworkCallback API to learn about connectivity changes. See ConnectivityManager#registerDefaultNetworkCallback and ConnectivityManager#registerNetworkCallback. These will give a more accurate picture of the connectivity state of the device and let apps react more easily and quickly to changes.

Java documentation for android.net.NetworkInfo.isConnected().

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