Methods Summary |
---|
public int | describeContents()Implement the Parcelable interface
return 0;
|
public android.net.NetworkInfo$DetailedState | getDetailedState()Reports the current fine-grained state of the network.
return mDetailedState;
|
public java.lang.String | getExtraInfo()Report the extra information about the network state, if any was
provided by the lower networking layers.,
if one is available.
return mExtraInfo;
|
public java.lang.String | getReason()Report the reason an attempt to establish connectivity failed,
if one is available.
return mReason;
|
public android.net.NetworkInfo$State | getState()Reports the current coarse-grained state of the network.
return mState;
|
public int | getSubtype()Return a network-type-specific integer describing the subtype
of the network.
return mSubtype;
|
public java.lang.String | getSubtypeName()Return a human-readable name describing the subtype of the network.
return mSubtypeName;
|
public int | getType()Reports the type of network (currently mobile or Wi-Fi) to which the
info in this object pertains.
return mNetworkType;
|
public java.lang.String | getTypeName()Return a human-readable name describe the type of the network,
for example "WIFI" or "MOBILE".
return mTypeName;
|
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.
- The device's radio is turned off, e.g., because airplane mode is enabled.
return mIsAvailable;
|
public boolean | isConnected()Indicates whether network connectivity exists and it is possible to establish
connections and pass data.
return mState == State.CONNECTED;
|
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 {@link #isConnected()} instead, which guarantees
that the network is fully usable.
return mState == State.CONNECTED || mState == State.CONNECTING;
|
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.
return mIsFailover;
|
public boolean | isRoaming()Indicates whether the device is currently roaming on this network.
When {@code true}, it suggests that use of data on this network
may incur extra costs.
return mIsRoaming;
|
void | setDetailedState(android.net.NetworkInfo$DetailedState detailedState, java.lang.String reason, java.lang.String extraInfo)Sets the fine-grained state of the network.
this.mDetailedState = detailedState;
this.mState = stateMap.get(detailedState);
this.mReason = reason;
this.mExtraInfo = extraInfo;
|
public void | setFailover(boolean isFailover)Set the failover boolean.
mIsFailover = isFailover;
|
public void | setIsAvailable(boolean isAvailable)Sets if the network is available, ie, if the connectivity is possible.
mIsAvailable = isAvailable;
|
void | setRoaming(boolean isRoaming)
mIsRoaming = isRoaming;
|
void | setSubtype(int subtype, java.lang.String subtypeName)
mSubtype = subtype;
mSubtypeName = subtypeName;
|
public java.lang.String | toString()
StringBuilder builder = new StringBuilder("NetworkInfo: ");
builder.append("type: ").append(getTypeName()).append("[").append(getSubtypeName()).
append("], state: ").append(mState).append("/").append(mDetailedState).
append(", reason: ").append(mReason == null ? "(unspecified)" : mReason).
append(", extra: ").append(mExtraInfo == null ? "(none)" : mExtraInfo).
append(", roaming: ").append(mIsRoaming).
append(", failover: ").append(mIsFailover).
append(", isAvailable: ").append(mIsAvailable);
return builder.toString();
|
public void | writeToParcel(android.os.Parcel dest, int flags)Implement the Parcelable interface.
dest.writeInt(mNetworkType);
dest.writeInt(mSubtype);
dest.writeString(mTypeName);
dest.writeString(mSubtypeName);
dest.writeString(mState.name());
dest.writeString(mDetailedState.name());
dest.writeInt(mIsFailover ? 1 : 0);
dest.writeInt(mIsAvailable ? 1 : 0);
dest.writeInt(mIsRoaming ? 1 : 0);
dest.writeString(mReason);
dest.writeString(mExtraInfo);
|