Most visited

Recently visited

Added in API level 23

NetworkStats.Bucket

public static class NetworkStats.Bucket
extends Object

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


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 ROAMING_ALL

Combined usage across all roaming states.

int ROAMING_NO

Usage that occurs on a home, non-roaming network.

int ROAMING_YES

Usage that occurs on a roaming network.

int STATE_ALL

Combined usage across all states.

int STATE_DEFAULT

Usage not accounted for in any other state.

int STATE_FOREGROUND

Foreground usage.

int TAG_NONE

Special TAG value for total data across all tags

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.

int getRoaming()

Roaming state.

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.

int getTag()

Tag of the bucket.

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.

Inherited methods

From class java.lang.Object

Constants

ROAMING_ALL

Added in API level 24
int ROAMING_ALL

Combined usage across all roaming states. Covers both roaming and non-roaming usage.

Constant Value: -1 (0xffffffff)

ROAMING_NO

Added in API level 24
int ROAMING_NO

Usage that occurs on a home, non-roaming network.

Any cellular usage in this bucket was incurred while the device was connected to a tower owned or operated by the user's wireless carrier, or a tower that the user's wireless carrier has indicated should be treated as a home network regardless.

This is also the default value for network types that do not support roaming.

Constant Value: 1 (0x00000001)

ROAMING_YES

Added in API level 24
int ROAMING_YES

Usage that occurs on a roaming network.

Any cellular usage in this bucket as incurred while the device was roaming on another carrier's network, for which additional charges may apply.

Constant Value: 2 (0x00000002)

STATE_ALL

Added in API level 23
int STATE_ALL

Combined usage across all states.

Constant Value: -1 (0xffffffff)

STATE_DEFAULT

Added in API level 23
int STATE_DEFAULT

Usage not accounted for in any other state.

Constant Value: 1 (0x00000001)

STATE_FOREGROUND

Added in API level 23
int STATE_FOREGROUND

Foreground usage.

Constant Value: 2 (0x00000002)

TAG_NONE

Added in API level 24
int TAG_NONE

Special TAG value for total data across all tags

Constant Value: 0 (0x00000000)

UID_ALL

Added in API level 23
int UID_ALL

Special UID value for aggregate/unspecified.

Constant Value: -1 (0xffffffff)

UID_REMOVED

Added in API level 23
int UID_REMOVED

Special UID value for removed apps.

Constant Value: -4 (0xfffffffc)

UID_TETHERING

Added in API level 23
int UID_TETHERING

Special UID value for data usage by tethering.

Constant Value: -5 (0xfffffffb)

Public constructors

NetworkStats.Bucket

Added in API level 23
NetworkStats.Bucket ()

Public methods

getEndTimeStamp

Added in API level 23
long getEndTimeStamp ()

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

Returns
long End of interval.

getRoaming

Added in API level 24
int getRoaming ()

Roaming state. One of the following values:

Returns
int

getRxBytes

Added in API level 23
long getRxBytes ()

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
long Number of bytes.

getRxPackets

Added in API level 23
long getRxPackets ()

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
long Number of packets.

getStartTimeStamp

Added in API level 23
long getStartTimeStamp ()

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

Returns
long Start of interval.

getState

Added in API level 23
int getState ()

Usage state. One of the following values:

Returns
int Usage state.

getTag

Added in API level 24
int getTag ()

Tag of the bucket.

Returns
int Bucket tag.

getTxBytes

Added in API level 23
long getTxBytes ()

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
long Number of bytes.

getTxPackets

Added in API level 23
long getTxPackets ()

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
long Number of packets.

getUid

Added in API level 23
int getUid ()

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

Returns
int Bucket key.

Hooray!