android.net.NetworkInfo
Describes the status of a network interface of a given type
(currently either Mobile or Wifi).
Nested Classes
Summary
Constants
Public Constructors
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Constants
Implement the Parcelable interface
Public Constructors
Public Methods
public
int
describeContents()
Implement the Parcelable interface
Reports the current fine-grained state of the network.
public
String
getExtraInfo()
Report the extra information about the network state, if any was
provided by the lower networking layers.,
if one is available.
Returns
- the extra information, or null if not available
public
String
getReason()
Report the reason an attempt to establish connectivity failed,
if one is available.
Returns
- the reason for failure, or null if not available
Reports the current coarse-grained state of the network.
Reports the type of network (currently mobile or Wi-Fi) to which the
info in this object pertains.
public
boolean
isAvailable()
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
- The device is out of the coverage area for any network of this type.
- The device is on a network other than the home network (i.e., roaming), and
data roaming has been disabled.
Returns
true
if the network is available, false
otherwise
public
boolean
isConnected()
Indicates whether network connectivity exists and it is possible to establish
connections and pass data.
Returns
true
if network connectivity exists, false
otherwise.
public
boolean
isConnectedOrConnecting()
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.
Returns
true
if network connectivity exists or is in the process
of being established, false
otherwise.
public
boolean
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.
Returns
true
if this is a failover attempt, false
otherwise.
public
void
setFailover(boolean isFailover)
public
void
setIsAvailable(boolean isAvailable)
Sets if the network is available, ie, if the connectivity is possible.
Parameters
isAvailable
| the new availability value.
|
public
String
toString()
Returns a string containing a concise, human-readable description of the
receiver.
Returns
- String a printable representation for the receiver.
public
void
writeToParcel(Parcel dest, int flags)
Implement the Parcelable interface