| java.lang.Object | |
| ↳ | android.net.TrafficStats | 
Class that provides network traffic statistics. These statistics include bytes transmitted and received and network packets transmitted and received, over all interfaces, over the mobile interface, and on a per-UID basis.
 These statistics may not be available on all platforms.  If the statistics
 are not supported by this device, UNSUPPORTED will be returned.
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| int | UNSUPPORTED | The return value to indicate that the device does not support the statistic. | |||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Clear any active tag set to account  Sockettraffic originating
 from the current thread. | |||||||||||
| Return number of bytes received across mobile networks since device boot. | |||||||||||
| Return number of packets received across mobile networks since device
 boot. | |||||||||||
| Return number of bytes transmitted across mobile networks since device
 boot. | |||||||||||
| Return number of packets transmitted across mobile networks since device
 boot. | |||||||||||
| Get the active tag used when accounting  Sockettraffic originating
 from the current thread. | |||||||||||
| Return number of bytes received since device boot. | |||||||||||
| Return number of packets received since device boot. | |||||||||||
| Return number of bytes transmitted since device boot. | |||||||||||
| Return number of packets transmitted since device boot. | |||||||||||
| Return number of bytes received by the given UID since device boot. | |||||||||||
| Return number of packets received by the given UID since device boot. | |||||||||||
| 
      This method was deprecated
      in API level 18.
    Starting in  JELLY_BEAN_MR2,
             transport layer statistics are no longer available, and will
             always returnUNSUPPORTED. | |||||||||||
| 
      This method was deprecated
      in API level 18.
    Starting in  JELLY_BEAN_MR2,
             transport layer statistics are no longer available, and will
             always returnUNSUPPORTED. | |||||||||||
| 
      This method was deprecated
      in API level 18.
    Starting in  JELLY_BEAN_MR2,
             transport layer statistics are no longer available, and will
             always returnUNSUPPORTED. | |||||||||||
| 
      This method was deprecated
      in API level 18.
    Starting in  JELLY_BEAN_MR2,
             transport layer statistics are no longer available, and will
             always returnUNSUPPORTED. | |||||||||||
| Return number of bytes transmitted by the given UID since device boot. | |||||||||||
| Return number of packets transmitted by the given UID since device boot. | |||||||||||
| 
      This method was deprecated
      in API level 18.
    Starting in  JELLY_BEAN_MR2,
             transport layer statistics are no longer available, and will
             always returnUNSUPPORTED. | |||||||||||
| 
      This method was deprecated
      in API level 18.
    Starting in  JELLY_BEAN_MR2,
             transport layer statistics are no longer available, and will
             always returnUNSUPPORTED. | |||||||||||
| 
      This method was deprecated
      in API level 18.
    Starting in  JELLY_BEAN_MR2,
             transport layer statistics are no longer available, and will
             always returnUNSUPPORTED. | |||||||||||
| 
      This method was deprecated
      in API level 18.
    Starting in  JELLY_BEAN_MR2,
             transport layer statistics are no longer available, and will
             always returnUNSUPPORTED. | |||||||||||
| Increment count of network operations performed under the given
 accounting tag. | |||||||||||
| Increment count of network operations performed under the accounting tag
 currently active on the calling thread. | |||||||||||
| Set active tag to use when accounting  Sockettraffic originating
 from the current thread. | |||||||||||
| Tag the given  Socketwith any statistics parameters active for
 the current thread. | |||||||||||
| Remove any statistics parameters from the given  Socket. | |||||||||||
| [Expand] Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|  From class
  java.lang.Object | |||||||||||
The return value to indicate that the device does not support the statistic.
Clear any active tag set to account Socket traffic originating
 from the current thread.
Return number of bytes received across mobile networks since device boot. Counts packets across all mobile network interfaces, and always increases monotonically since device boot. Statistics are measured at the network layer, so they include both TCP and UDP usage.
 Before JELLY_BEAN_MR2, this may
 return UNSUPPORTED on devices where statistics aren't available.
Return number of packets received across mobile networks since device boot. Counts packets across all mobile network interfaces, and always increases monotonically since device boot. Statistics are measured at the network layer, so they include both TCP and UDP usage.
 Before JELLY_BEAN_MR2, this may
 return UNSUPPORTED on devices where statistics aren't available.
Return number of bytes transmitted across mobile networks since device boot. Counts packets across all mobile network interfaces, and always increases monotonically since device boot. Statistics are measured at the network layer, so they include both TCP and UDP usage.
 Before JELLY_BEAN_MR2, this may
 return UNSUPPORTED on devices where statistics aren't available.
Return number of packets transmitted across mobile networks since device boot. Counts packets across all mobile network interfaces, and always increases monotonically since device boot. Statistics are measured at the network layer, so they include both TCP and UDP usage.
 Before JELLY_BEAN_MR2, this may
 return UNSUPPORTED on devices where statistics aren't available.
Get the active tag used when accounting Socket traffic originating
 from the current thread. Only one active tag per thread is supported.
 tagSocket(Socket).
Return number of bytes received since device boot. Counts packets across all network interfaces, and always increases monotonically since device boot. Statistics are measured at the network layer, so they include both TCP and UDP usage.
 Before JELLY_BEAN_MR2, this may
 return UNSUPPORTED on devices where statistics aren't available.
Return number of packets received since device boot. Counts packets across all network interfaces, and always increases monotonically since device boot. Statistics are measured at the network layer, so they include both TCP and UDP usage.
 Before JELLY_BEAN_MR2, this may
 return UNSUPPORTED on devices where statistics aren't available.
Return number of bytes transmitted since device boot. Counts packets across all network interfaces, and always increases monotonically since device boot. Statistics are measured at the network layer, so they include both TCP and UDP usage.
 Before JELLY_BEAN_MR2, this may
 return UNSUPPORTED on devices where statistics aren't available.
Return number of packets transmitted since device boot. Counts packets across all network interfaces, and always increases monotonically since device boot. Statistics are measured at the network layer, so they include both TCP and UDP usage.
 Before JELLY_BEAN_MR2, this may
 return UNSUPPORTED on devices where statistics aren't available.
Return number of bytes received by the given UID since device boot. Counts packets across all network interfaces, and always increases monotonically since device boot. Statistics are measured at the network layer, so they include both TCP and UDP usage.
 Before JELLY_BEAN_MR2, this may return
 UNSUPPORTED on devices where statistics aren't available.
Return number of packets received by the given UID since device boot. Counts packets across all network interfaces, and always increases monotonically since device boot. Statistics are measured at the network layer, so they include both TCP and UDP usage.
 Before JELLY_BEAN_MR2, this may return
 UNSUPPORTED on devices where statistics aren't available.
      This method was deprecated
      in API level 18.
    Starting in JELLY_BEAN_MR2,
             transport layer statistics are no longer available, and will
             always return UNSUPPORTED.
  
      This method was deprecated
      in API level 18.
    Starting in JELLY_BEAN_MR2,
             transport layer statistics are no longer available, and will
             always return UNSUPPORTED.
  
      This method was deprecated
      in API level 18.
    Starting in JELLY_BEAN_MR2,
             transport layer statistics are no longer available, and will
             always return UNSUPPORTED.
  
      This method was deprecated
      in API level 18.
    Starting in JELLY_BEAN_MR2,
             transport layer statistics are no longer available, and will
             always return UNSUPPORTED.
  
Return number of bytes transmitted by the given UID since device boot. Counts packets across all network interfaces, and always increases monotonically since device boot. Statistics are measured at the network layer, so they include both TCP and UDP usage.
 Before JELLY_BEAN_MR2, this may return
 UNSUPPORTED on devices where statistics aren't available.
Return number of packets transmitted by the given UID since device boot. Counts packets across all network interfaces, and always increases monotonically since device boot. Statistics are measured at the network layer, so they include both TCP and UDP usage.
 Before JELLY_BEAN_MR2, this may return
 UNSUPPORTED on devices where statistics aren't available.
      This method was deprecated
      in API level 18.
    Starting in JELLY_BEAN_MR2,
             transport layer statistics are no longer available, and will
             always return UNSUPPORTED.
  
      This method was deprecated
      in API level 18.
    Starting in JELLY_BEAN_MR2,
             transport layer statistics are no longer available, and will
             always return UNSUPPORTED.
  
      This method was deprecated
      in API level 18.
    Starting in JELLY_BEAN_MR2,
             transport layer statistics are no longer available, and will
             always return UNSUPPORTED.
  
      This method was deprecated
      in API level 18.
    Starting in JELLY_BEAN_MR2,
             transport layer statistics are no longer available, and will
             always return UNSUPPORTED.
  
Increment count of network operations performed under the given accounting tag. This can be used to derive bytes-per-operation.
| tag | Accounting tag used in setThreadStatsTag(int). | 
|---|---|
| operationCount | Number of operations to increment count by. | 
Increment count of network operations performed under the accounting tag currently active on the calling thread. This can be used to derive bytes-per-operation.
| operationCount | Number of operations to increment count by. | 
|---|
Set active tag to use when accounting Socket traffic originating
 from the current thread. Only one active tag per thread is supported.
 
 Changes only take effect during subsequent calls to
 tagSocket(Socket).
 
 Tags between 0xFFFFFF00 and 0xFFFFFFFF are reserved and
 used internally by system services like DownloadManager when
 performing traffic on behalf of an application.
Tag the given Socket with any statistics parameters active for
 the current thread. Subsequent calls always replace any existing
 parameters. When finished, call untagSocket(Socket) to remove
 statistics parameters.
| SocketException | 
|---|
Remove any statistics parameters from the given Socket.
| SocketException | 
|---|