# Print output for @column tags ?>
  public
  
  final
  
  class
  NetworkCapabilities
  
    extends Object
  
  
  
  
  
      implements
      
        Parcelable
      
  
  
| java.lang.Object | |
| ↳ | android.net.NetworkCapabilities | 
Representation of the capabilities of an active network. Instances are
 typically obtained through
 NetworkCallback#onCapabilitiesChanged(Network, NetworkCapabilities)
 or ConnectivityManager#getNetworkCapabilities(Network).
 
 This replaces the old ConnectivityManager#TYPE_MOBILE method of
 network selection. Rather than indicate a need for Wi-Fi because an
 application needs high bandwidth and risk obsolescence when a new, fast
 network appears (like LTE), the application should specify it needs high
 bandwidth. Similarly if an application needs an unmetered network for a bulk
 transfer it can specify that rather than assuming all cellular based
 connections are metered and all Wi-Fi based connections are not.
Constants | |
|---|---|
int | 
        
          NET_CAPABILITY_CAPTIVE_PORTAL
          Indicates that this network was found to have a captive portal in place last time it was probed.  | 
    
int | 
        
          NET_CAPABILITY_CBS
          Indicates this is a network that has the ability to reach the carrier's CBS servers, used for carrier specific services.  | 
    
int | 
        
          NET_CAPABILITY_DUN
          Indicates this is a network that has the ability to reach the carrier's DUN or tethering gateway.  | 
    
int | 
        
          NET_CAPABILITY_EIMS
          Indicates this is a network that has the ability to reach a carrier's Emergency IMS servers or other services, used for network signaling during emergency calls.  | 
    
int | 
        
          NET_CAPABILITY_FOREGROUND
          Indicates that this network is available for use by apps, and not a network that is being kept up in the background to facilitate fast network switching.  | 
    
int | 
        
          NET_CAPABILITY_FOTA
          Indicates this is a network that has the ability to reach the carrier's FOTA portal, used for over the air updates.  | 
    
int | 
        
          NET_CAPABILITY_IA
          Indicates this is a network that has the ability to reach a carrier's Initial Attach servers.  | 
    
int | 
        
          NET_CAPABILITY_IMS
          Indicates this is a network that has the ability to reach the carrier's IMS servers, used for network registration and signaling.  | 
    
int | 
        
          NET_CAPABILITY_INTERNET
          Indicates that this network should be able to reach the internet.  | 
    
int | 
        
          NET_CAPABILITY_MCX
          Indicates this is a network that has the ability to reach a carrier's Mission Critical servers.  | 
    
int | 
        
          NET_CAPABILITY_MMS
          Indicates this is a network that has the ability to reach the carrier's MMSC for sending and receiving MMS messages.  | 
    
int | 
        
          NET_CAPABILITY_NOT_CONGESTED
          Indicates that this network is not congested.  | 
    
int | 
        
          NET_CAPABILITY_NOT_METERED
          Indicates that this network is unmetered.  | 
    
int | 
        
          NET_CAPABILITY_NOT_RESTRICTED
          Indicates that this network is available for general use.  | 
    
int | 
        
          NET_CAPABILITY_NOT_ROAMING
          Indicates that this network is not roaming.  | 
    
int | 
        
          NET_CAPABILITY_NOT_SUSPENDED
          Indicates that this network is not currently suspended.  | 
    
int | 
        
          NET_CAPABILITY_NOT_VPN
          Indicates that this network is not a VPN.  | 
    
int | 
        
          NET_CAPABILITY_RCS
          Indicates this is a network that has the ability to reach a carrier's RCS servers, used for Rich Communication Services.  | 
    
int | 
        
          NET_CAPABILITY_SUPL
          Indicates this is a network that has the ability to reach the carrier's SUPL server, used to retrieve GPS information.  | 
    
int | 
        
          NET_CAPABILITY_TEMPORARILY_NOT_METERED
          This capability will be set for networks that are generally metered, but are currently unmetered, e.g., because the user is in a particular area.  | 
    
int | 
        
          NET_CAPABILITY_TRUSTED
          Indicates that the user has indicated implicit trust of this network.  | 
    
int | 
        
          NET_CAPABILITY_VALIDATED
          Indicates that connectivity on this network was successfully validated.  | 
    
int | 
        
          NET_CAPABILITY_WIFI_P2P
          Indicates this is a network that has the ability to reach a Wi-Fi direct peer.  | 
    
int | 
        
          NET_CAPABILITY_XCAP
          Indicates this is a network that has the ability to reach a carrier's XCAP servers, used for configuration and control.  | 
    
int | 
        
          SIGNAL_STRENGTH_UNSPECIFIED
          Magic value that indicates no signal strength provided.  | 
    
int | 
        
          TRANSPORT_BLUETOOTH
          Indicates this network uses a Bluetooth transport.  | 
    
int | 
        
          TRANSPORT_CELLULAR
          Indicates this network uses a Cellular transport.  | 
    
int | 
        
          TRANSPORT_ETHERNET
          Indicates this network uses an Ethernet transport.  | 
    
int | 
        
          TRANSPORT_LOWPAN
          Indicates this network uses a LoWPAN transport.  | 
    
int | 
        
          TRANSPORT_VPN
          Indicates this network uses a VPN transport.  | 
    
int | 
        
          TRANSPORT_WIFI
          Indicates this network uses a Wi-Fi transport.  | 
    
int | 
        
          TRANSPORT_WIFI_AWARE
          Indicates this network uses a Wi-Fi Aware transport.  | 
    
Inherited constants | 
|---|
Fields | |
|---|---|
    public
    static
    final
    Creator<NetworkCapabilities> | 
    
      CREATOR
      
  | 
  
Public constructors | |
|---|---|
      
      NetworkCapabilities()
      
      
     | 
  |
      
      NetworkCapabilities(NetworkCapabilities nc)
      
      
     | 
  |
Public methods | |
|---|---|
        
        
        
        
        
        int
     | 
  
    
      
      describeContents()
      
      
        Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.  | 
  
        
        
        
        
        
        boolean
     | 
  
    
      
      equals(Object obj)
      
      
        Indicates whether some other object is "equal to" this one.  | 
  
        
        
        
        
        
        int
     | 
  
    
      
      getLinkDownstreamBandwidthKbps()
      
      
        Retrieves the downstream bandwidth for this network in Kbps.  | 
  
        
        
        
        
        
        int
     | 
  
    
      
      getLinkUpstreamBandwidthKbps()
      
      
        Retrieves the upstream bandwidth for this network in Kbps.  | 
  
        
        
        
        
        
        NetworkSpecifier
     | 
  
    
      
      getNetworkSpecifier()
      
      
        Gets the optional bearer specific network specifier.  | 
  
        
        
        
        
        
        int
     | 
  
    
      
      getOwnerUid()
      
      
        Retrieves the UID of the app that owns this network.  | 
  
        
        
        
        
        
        int
     | 
  
    
      
      getSignalStrength()
      
      
        Retrieves the signal strength.  | 
  
        
        
        
        
        
        TransportInfo
     | 
  
    
      
      getTransportInfo()
      
      
        Returns a transport-specific information container.  | 
  
        
        
        
        
        
        boolean
     | 
  
    
      
      hasCapability(int capability)
      
      
        Tests for the presence of a capability on this instance.  | 
  
        
        
        
        
        
        boolean
     | 
  
    
      
      hasTransport(int transportType)
      
      
        Tests for the presence of a transport on this instance.  | 
  
        
        
        
        
        
        int
     | 
  
    
      
      hashCode()
      
      
        Returns a hash code value for the object.  | 
  
        
        
        
        
        
        String
     | 
  
    
      
      toString()
      
      
        Returns a string representation of the object.  | 
  
        
        
        
        
        
        void
     | 
  
    
      
      writeToParcel(Parcel dest, int flags)
      
      
        Flatten this object in to a Parcel.  | 
  
Inherited methods | |
|---|---|
public static final int NET_CAPABILITY_CAPTIVE_PORTAL
Indicates that this network was found to have a captive portal in place last time it was probed.
Constant Value: 17 (0x00000011)
public static final int NET_CAPABILITY_CBS
Indicates this is a network that has the ability to reach the carrier's CBS servers, used for carrier specific services.
Constant Value: 5 (0x00000005)
public static final int NET_CAPABILITY_DUN
Indicates this is a network that has the ability to reach the carrier's DUN or tethering gateway.
Constant Value: 2 (0x00000002)
public static final int NET_CAPABILITY_EIMS
Indicates this is a network that has the ability to reach a carrier's Emergency IMS servers or other services, used for network signaling during emergency calls.
Constant Value: 10 (0x0000000a)
public static final int NET_CAPABILITY_FOREGROUND
Indicates that this network is available for use by apps, and not a network that is being kept up in the background to facilitate fast network switching.
Constant Value: 19 (0x00000013)
public static final int NET_CAPABILITY_FOTA
Indicates this is a network that has the ability to reach the carrier's FOTA portal, used for over the air updates.
Constant Value: 3 (0x00000003)
public static final int NET_CAPABILITY_IA
Indicates this is a network that has the ability to reach a carrier's Initial Attach servers.
Constant Value: 7 (0x00000007)
public static final int NET_CAPABILITY_IMS
Indicates this is a network that has the ability to reach the carrier's IMS servers, used for network registration and signaling.
Constant Value: 4 (0x00000004)
public static final int NET_CAPABILITY_INTERNET
Indicates that this network should be able to reach the internet.
Constant Value: 12 (0x0000000c)
public static final int NET_CAPABILITY_MCX
Indicates this is a network that has the ability to reach a carrier's Mission Critical servers.
Constant Value: 23 (0x00000017)
public static final int NET_CAPABILITY_MMS
Indicates this is a network that has the ability to reach the carrier's MMSC for sending and receiving MMS messages.
Constant Value: 0 (0x00000000)
public static final int NET_CAPABILITY_NOT_CONGESTED
Indicates that this network is not congested.
When a network is congested, applications should defer network traffic that can be done at a later time, such as uploading analytics.
Constant Value: 20 (0x00000014)
public static final int NET_CAPABILITY_NOT_METERED
Indicates that this network is unmetered.
Constant Value: 11 (0x0000000b)
public static final int NET_CAPABILITY_NOT_RESTRICTED
Indicates that this network is available for general use. If this is not set applications should not attempt to communicate on this network. Note that this is simply informative and not enforcement - enforcement is handled via other means. Set by default.
Constant Value: 13 (0x0000000d)
public static final int NET_CAPABILITY_NOT_ROAMING
Indicates that this network is not roaming.
Constant Value: 18 (0x00000012)
public static final int NET_CAPABILITY_NOT_SUSPENDED
Indicates that this network is not currently suspended.
When a network is suspended, the network's IP addresses and any connections established on the network remain valid, but the network is temporarily unable to transfer data. This can happen, for example, if a cellular network experiences a temporary loss of signal, such as when driving through a tunnel, etc. A network with this capability is not suspended, so is expected to be able to transfer data.
Constant Value: 21 (0x00000015)
public static final int NET_CAPABILITY_NOT_VPN
Indicates that this network is not a VPN. This capability is set by default and should be explicitly cleared for VPN networks.
Constant Value: 15 (0x0000000f)
public static final int NET_CAPABILITY_RCS
Indicates this is a network that has the ability to reach a carrier's RCS servers, used for Rich Communication Services.
Constant Value: 8 (0x00000008)
public static final int NET_CAPABILITY_SUPL
Indicates this is a network that has the ability to reach the carrier's SUPL server, used to retrieve GPS information.
Constant Value: 1 (0x00000001)
public static final int NET_CAPABILITY_TEMPORARILY_NOT_METERED
This capability will be set for networks that are generally metered, but are currently unmetered, e.g., because the user is in a particular area. This capability can be changed at any time. When it is removed, applications are responsible for stopping any data transfer that should not occur on a metered network.
Constant Value: 25 (0x00000019)
public static final int NET_CAPABILITY_TRUSTED
Indicates that the user has indicated implicit trust of this network. This generally means it's a sim-selected carrier, a plugged in ethernet, a paired BT device or a wifi the user asked to connect to. Untrusted networks are probably limited to unknown wifi AP. Set by default.
Constant Value: 14 (0x0000000e)
public static final int NET_CAPABILITY_VALIDATED
Indicates that connectivity on this network was successfully validated. For example, for a network with NET_CAPABILITY_INTERNET, it means that Internet connectivity was successfully detected.
Constant Value: 16 (0x00000010)
public static final int NET_CAPABILITY_WIFI_P2P
Indicates this is a network that has the ability to reach a Wi-Fi direct peer.
Constant Value: 6 (0x00000006)
public static final int NET_CAPABILITY_XCAP
Indicates this is a network that has the ability to reach a carrier's XCAP servers, used for configuration and control.
Constant Value: 9 (0x00000009)
public static final int SIGNAL_STRENGTH_UNSPECIFIED
Magic value that indicates no signal strength provided. A request specifying this value is always satisfied.
Constant Value: -2147483648 (0x80000000)
public static final int TRANSPORT_BLUETOOTH
Indicates this network uses a Bluetooth transport.
Constant Value: 2 (0x00000002)
public static final int TRANSPORT_CELLULAR
Indicates this network uses a Cellular transport.
Constant Value: 0 (0x00000000)
public static final int TRANSPORT_ETHERNET
Indicates this network uses an Ethernet transport.
Constant Value: 3 (0x00000003)
public static final int TRANSPORT_LOWPAN
Indicates this network uses a LoWPAN transport.
Constant Value: 6 (0x00000006)
public static final int TRANSPORT_VPN
Indicates this network uses a VPN transport.
Constant Value: 4 (0x00000004)
public static final int TRANSPORT_WIFI
Indicates this network uses a Wi-Fi transport.
Constant Value: 1 (0x00000001)
public static final int TRANSPORT_WIFI_AWARE
Indicates this network uses a Wi-Fi Aware transport.
Constant Value: 5 (0x00000005)
public NetworkCapabilities ()
public NetworkCapabilities (NetworkCapabilities nc)
| Parameters | |
|---|---|
nc | 
        
          NetworkCapabilities  | 
      
public int describeContents ()
Describe the kinds of special objects contained in this Parcelable
 instance's marshaled representation. For example, if the object will
 include a file descriptor in the output of writeToParcel(android.os.Parcel, int),
 the return value of this method must include the
 CONTENTS_FILE_DESCRIPTOR bit.
| Returns | |
|---|---|
int | 
        a bitmask indicating the set of special object types marshaled
 by this Parcelable object instance.
 
 Value is either 0 or CONTENTS_FILE_DESCRIPTOR | 
      
public boolean equals (Object obj)
Indicates whether some other object is "equal to" this one.
 The equals method implements an equivalence relation
 on non-null object references:
 
x, x.equals(x) should return
     true.
 x and y, x.equals(y)
     should return true if and only if
     y.equals(x) returns true.
 x, y, and z, if
     x.equals(y) returns true and
     y.equals(z) returns true, then
     x.equals(z) should return true.
 x and y, multiple invocations of
     x.equals(y) consistently return true
     or consistently return false, provided no
     information used in equals comparisons on the
     objects is modified.
 x,
     x.equals(null) should return false.
 
 The equals method for class Object implements
 the most discriminating possible equivalence relation on objects;
 that is, for any non-null reference values x and
 y, this method returns true if and only
 if x and y refer to the same object
 (x == y has the value true).
 
 Note that it is generally necessary to override the hashCode
 method whenever this method is overridden, so as to maintain the
 general contract for the hashCode method, which states
 that equal objects must have equal hash codes.
| Parameters | |
|---|---|
obj | 
        
          Object: This value may be null. | 
      
| Returns | |
|---|---|
boolean | 
        true if this object is the same as the obj
          argument; false otherwise. | 
      
public int getLinkDownstreamBandwidthKbps ()
Retrieves the downstream bandwidth for this network in Kbps. This always only refers to the estimated first hop transport bandwidth.
| Returns | |
|---|---|
int | 
        The estimated first hop downstream (network to device) bandwidth. | 
public int getLinkUpstreamBandwidthKbps ()
Retrieves the upstream bandwidth for this network in Kbps. This always only refers to the estimated first hop transport bandwidth.
| Returns | |
|---|---|
int | 
        The estimated first hop upstream (device to network) bandwidth. | 
public NetworkSpecifier getNetworkSpecifier ()
Gets the optional bearer specific network specifier. May be null if not set.
| Returns | |
|---|---|
NetworkSpecifier | 
        The optional NetworkSpecifier specifying the bearer specific network
         specifier or null. | 
      
public int getOwnerUid ()
Retrieves the UID of the app that owns this network.
For user privacy reasons, this field will only be populated if the following conditions are met:
The caller is the network owner, AND one of the following sets of requirements is met:
OR:
| Returns | |
|---|---|
int | 
        |
public int getSignalStrength ()
Retrieves the signal strength.
| Returns | |
|---|---|
int | 
        The bearer-specific signal strength. | 
public TransportInfo getTransportInfo ()
Returns a transport-specific information container. The application may cast this
 container to a concrete sub-class based on its knowledge of the network request. The
 application should be able to deal with a null return value or an invalid case,
 e.g. use instanceof operator to verify expected type.
| Returns | |
|---|---|
TransportInfo | 
        A concrete implementation of the TransportInfo class or null if not
 available for the network. | 
      
public boolean hasCapability (int capability)
Tests for the presence of a capability on this instance.
| Parameters | |
|---|---|
capability | 
        
          int: the capabilities to be tested for.
 Value is NET_CAPABILITY_MMS, NET_CAPABILITY_SUPL, NET_CAPABILITY_DUN, NET_CAPABILITY_FOTA, NET_CAPABILITY_IMS, NET_CAPABILITY_CBS, NET_CAPABILITY_WIFI_P2P, NET_CAPABILITY_IA, NET_CAPABILITY_RCS, NET_CAPABILITY_XCAP, NET_CAPABILITY_EIMS, NET_CAPABILITY_NOT_METERED, NET_CAPABILITY_INTERNET, NET_CAPABILITY_NOT_RESTRICTED, NET_CAPABILITY_TRUSTED, NET_CAPABILITY_NOT_VPN, NET_CAPABILITY_VALIDATED, NET_CAPABILITY_CAPTIVE_PORTAL, NET_CAPABILITY_NOT_ROAMING, NET_CAPABILITY_FOREGROUND, NET_CAPABILITY_NOT_CONGESTED, NET_CAPABILITY_NOT_SUSPENDED, android.net.NetworkCapabilities.NET_CAPABILITY_OEM_PAID, NET_CAPABILITY_MCX, android.net.NetworkCapabilities.NET_CAPABILITY_PARTIAL_CONNECTIVITY, or NET_CAPABILITY_TEMPORARILY_NOT_METERED | 
      
| Returns | |
|---|---|
boolean | 
        true if set on this instance. | 
      
public boolean hasTransport (int transportType)
Tests for the presence of a transport on this instance.
| Parameters | |
|---|---|
transportType | 
        
          int: the transport type to be tested for.
 Value is TRANSPORT_CELLULAR, TRANSPORT_WIFI, TRANSPORT_BLUETOOTH, TRANSPORT_ETHERNET, TRANSPORT_VPN, TRANSPORT_WIFI_AWARE, TRANSPORT_LOWPAN, or android.net.NetworkCapabilities.TRANSPORT_TEST | 
      
| Returns | |
|---|---|
boolean | 
        true if set on this instance. | 
      
public int hashCode ()
Returns a hash code value for the object. This method is
 supported for the benefit of hash tables such as those provided by
 HashMap.
 
 The general contract of hashCode is:
 
hashCode method
     must consistently return the same integer, provided no information
     used in equals comparisons on the object is modified.
     This integer need not remain consistent from one execution of an
     application to another execution of the same application.
 equals(Object)
     method, then calling the hashCode method on each of
     the two objects must produce the same integer result.
 equals(java.lang.Object)
     method, then calling the hashCode method on each of the
     two objects must produce distinct integer results.  However, the
     programmer should be aware that producing distinct integer results
     for unequal objects may improve the performance of hash tables.
 
 As much as is reasonably practical, the hashCode method defined by
 class Object does return distinct integers for distinct
 objects. (This is typically implemented by converting the internal
 address of the object into an integer, but this implementation
 technique is not required by the
 Java™ programming language.)
| Returns | |
|---|---|
int | 
        a hash code value for this object. | 
public String toString ()
Returns a string representation of the object. In general, the
 toString method returns a string that
 "textually represents" this object. The result should
 be a concise but informative representation that is easy for a
 person to read.
 It is recommended that all subclasses override this method.
 
 The toString method for class Object
 returns a string consisting of the name of the class of which the
 object is an instance, the at-sign character `@', and
 the unsigned hexadecimal representation of the hash code of the
 object. In other words, this method returns a string equal to the
 value of:
 
getClass().getName() + '@' + Integer.toHexString(hashCode())
| Returns | |
|---|---|
String | 
        This value cannot be null. | 
      
public void writeToParcel (Parcel dest, int flags)
Flatten this object in to a Parcel.
| Parameters | |
|---|---|
dest | 
        
          Parcel: The Parcel in which the object should be written. | 
      
flags | 
        
          int: Additional flags about how the object should be written.
 May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE.
 
 Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |