Android APIs
public static class

NetworkStats.Bucket

extends Object
java.lang.Object
   ↳ android.app.usage.NetworkStats.Bucket

Class Overview

Buckets are the smallest elements of a query result. As some dimensions of a result may be aggregated (e.g. time or state) some values may be equal across all buckets.

Summary

Constants
int STATE_ALL Combined usage across all other states.
int STATE_DEFAULT Usage not accounted in any other states.
int STATE_FOREGROUND Foreground usage.
int UID_ALL Special UID value for aggregate/unspecified.
int UID_REMOVED Special UID value for removed apps.
int UID_TETHERING Special UID value for data usage by tethering.
Public Constructors
NetworkStats.Bucket()
Public Methods
long getEndTimeStamp()
End timestamp of the bucket's time interval.
long getRxBytes()
Number of bytes received during the bucket's time interval.
long getRxPackets()
Number of packets received during the bucket's time interval.
long getStartTimeStamp()
Start timestamp of the bucket's time interval.
int getState()
Usage state.
long getTxBytes()
Number of bytes transmitted during the bucket's time interval.
long getTxPackets()
Number of packets transmitted during the bucket's time interval.
int getUid()
Key of the bucket.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int STATE_ALL

Added in API level 23

Combined usage across all other states.

Constant Value: -1 (0xffffffff)

public static final int STATE_DEFAULT

Added in API level 23

Usage not accounted in any other states.

Constant Value: 1 (0x00000001)

public static final int STATE_FOREGROUND

Added in API level 23

Foreground usage.

Constant Value: 2 (0x00000002)

public static final int UID_ALL

Added in API level 23

Special UID value for aggregate/unspecified.

Constant Value: -1 (0xffffffff)

public static final int UID_REMOVED

Added in API level 23

Special UID value for removed apps.

Constant Value: -4 (0xfffffffc)

public static final int UID_TETHERING

Added in API level 23

Special UID value for data usage by tethering.

Constant Value: -5 (0xfffffffb)

Public Constructors

public NetworkStats.Bucket ()

Added in API level 23

Public Methods

public long getEndTimeStamp ()

Added in API level 23

End timestamp of the bucket's time interval. Defined in terms of "Unix time", see currentTimeMillis().

Returns
  • End of interval.

public long getRxBytes ()

Added in API level 23

Number of bytes received during the bucket's time interval. Statistics are measured at the network layer, so they include both TCP and UDP usage.

Returns
  • Number of bytes.

public long getRxPackets ()

Added in API level 23

Number of packets received during the bucket's time interval. Statistics are measured at the network layer, so they include both TCP and UDP usage.

Returns
  • Number of packets.

public long getStartTimeStamp ()

Added in API level 23

Start timestamp of the bucket's time interval. Defined in terms of "Unix time", see currentTimeMillis().

Returns
  • Start of interval.

public int getState ()

Added in API level 23

Usage state. One of the following values:

Returns
  • Usage state.

public long getTxBytes ()

Added in API level 23

Number of bytes transmitted during the bucket's time interval. Statistics are measured at the network layer, so they include both TCP and UDP usage.

Returns
  • Number of bytes.

public long getTxPackets ()

Added in API level 23

Number of packets transmitted during the bucket's time interval. Statistics are measured at the network layer, so they include both TCP and UDP usage.

Returns
  • Number of packets.

public int getUid ()

Added in API level 23

Key of the bucket. Usually an app uid or one of the following special values:

Returns
  • Bucket key.