java.lang.Object | |
↳ | android.net.NetworkInfo |
Describes the status of a network interface.
Use getActiveNetworkInfo()
to get an instance that represents
the current network connection.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
NetworkInfo.DetailedState | The fine-grained state of a network connection. | ||||||||||
NetworkInfo.State | Coarse-grained network state. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.os.Parcelable
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Reports the current fine-grained state of the network.
| |||||||||||
Report the extra information about the network state, if any was
provided by the lower networking layers.,
if one is available.
| |||||||||||
Report the reason an attempt to establish connectivity failed,
if one is available.
| |||||||||||
Reports the current coarse-grained state of the network.
| |||||||||||
Return a network-type-specific integer describing the subtype
of the network.
| |||||||||||
Return a human-readable name describing the subtype of the network.
| |||||||||||
Reports the type of network to which the
info in this
NetworkInfo pertains. | |||||||||||
Return a human-readable name describe the type of the network,
for example "WIFI" or "MOBILE".
| |||||||||||
Indicates whether network connectivity is possible.
| |||||||||||
Indicates whether network connectivity exists and it is possible to establish
connections and pass data.
| |||||||||||
Indicates whether network connectivity exists or is in the process
of being established.
| |||||||||||
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.
| |||||||||||
Indicates whether the device is currently roaming on this network.
| |||||||||||
Returns a string containing a concise, human-readable description of this
object.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
android.os.Parcelable
|
Reports the current fine-grained state of the network.
Report the extra information about the network state, if any was provided by the lower networking layers., if one is available.
Report the reason an attempt to establish connectivity failed, if one is available.
Reports the current coarse-grained state of the network.
Return a network-type-specific integer describing the subtype of the network.
Return a human-readable name describing the subtype of the network.
Reports the type of network to which the
info in this NetworkInfo
pertains.
TYPE_MOBILE
, TYPE_WIFI
, TYPE_WIMAX
, TYPE_ETHERNET
, TYPE_BLUETOOTH
, or other
types defined by ConnectivityManager
Return a human-readable name describe the type of the network, for example "WIFI" or "MOBILE".
Indicates whether network connectivity is possible. A network is unavailable when a persistent or semi-persistent condition prevents the possibility of connecting to that network. Examples include
true
if the network is available, false
otherwise
Indicates whether network connectivity exists and it is possible to establish connections and pass data.
Always call this before attempting to perform data transactions.
true
if network connectivity exists, false
otherwise.
Indicates whether network connectivity exists or is in the process
of being established. This is good for applications that need to
do anything related to the network other than read or write data.
For the latter, call isConnected()
instead, which guarantees
that the network is fully usable.
true
if network connectivity exists or is in the process
of being established, false
otherwise.
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.
true
if this is a failover attempt, false
otherwise.
Indicates whether the device is currently roaming on this network.
When true
, it suggests that use of data on this network
may incur extra costs.
true
if roaming is in effect, false
otherwise.
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString
method
if you intend implementing your own toString
method.