# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Constants | Ctors | Methods | Inherited Methods

# 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` | `DEFAULT_NETWORK_ALL` Combined usage for this network regardless of default network status.
`int` | `DEFAULT_NETWORK_NO` Usage that occurs while this network is not a default network.
`int` | `DEFAULT_NETWORK_YES` Usage that occurs while this network is a default network.
`int` | `METERED_ALL` Combined usage across all metered states.
`int` | `METERED_NO` Usage that occurs on an unmetered network.
`int` | `METERED_YES` Usage that occurs on a metered network.
`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
`Bucket()`

### Public methods
`int` | `getDefaultNetworkStatus()` Default network status.
`long` | `getEndTimeStamp()` End timestamp of the bucket's time interval.
`int` | `getMetered()` Metered state.
`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`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Constants

### DEFAULT_NETWORK_ALL

    public static final int DEFAULT_NETWORK_ALL

Combined usage for this network regardless of default network status.

Constant Value: -1 (0xffffffff)

### DEFAULT_NETWORK_NO

    public static final int DEFAULT_NETWORK_NO

Usage that occurs while this network is not a default network.

This implies that the app responsible for this usage requested that it occur on a specific network different from the one(s) the system would have selected for it.

Constant Value: 1 (0x00000001)

### DEFAULT_NETWORK_YES

    public static final int DEFAULT_NETWORK_YES

Usage that occurs while this network is a default network.

This implies that the app either did not select a specific network for this usage, or it selected a network that the system could have selected for app traffic.

Constant Value: 2 (0x00000002)

### METERED_ALL

    public static final int METERED_ALL

Combined usage across all metered states. Covers metered and unmetered usage.

Constant Value: -1 (0xffffffff)

### METERED_NO

    public static final int METERED_NO

Usage that occurs on an unmetered network.

Constant Value: 1 (0x00000001)

### METERED_YES

    public static final int METERED_YES

Usage that occurs on a metered network.

A network is classified as metered when the user is sensitive to heavy data usage on that connection.

Constant Value: 2 (0x00000002)

### ROAMING_ALL

    public static final int ROAMING_ALL

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

Constant Value: -1 (0xffffffff)

### ROAMING_NO

    public static final 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

    public static final 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

    public static final int STATE_ALL

Combined usage across all states.

Constant Value: -1 (0xffffffff)

### STATE_DEFAULT

    public static final int STATE_DEFAULT

Usage not accounted for in any other state.

Constant Value: 1 (0x00000001)

### STATE_FOREGROUND

    public static final int STATE_FOREGROUND

Foreground usage.

Constant Value: 2 (0x00000002)

### TAG_NONE

    public static final int TAG_NONE

Special TAG value for total data across all tags

Constant Value: 0 (0x00000000)

### UID_ALL

    public static final int UID_ALL

Special UID value for aggregate/unspecified.

Constant Value: -1 (0xffffffff)

### UID_REMOVED

    public static final int UID_REMOVED

Special UID value for removed apps.

Constant Value: -4 (0xfffffffc)

### UID_TETHERING

    public static final int UID_TETHERING

Special UID value for data usage by tethering.

Constant Value: -5 (0xfffffffb)

## Public constructors

### Bucket

    public Bucket ()

## Public methods

### getDefaultNetworkStatus

    public int getDefaultNetworkStatus ()

Default network status. One of the following values:

- `DEFAULT_NETWORK_ALL`
- `DEFAULT_NETWORK_NO`
- `DEFAULT_NETWORK_YES`

Returns
`int` | Value is `DEFAULT_NETWORK_ALL`, `DEFAULT_NETWORK_NO`, or `DEFAULT_NETWORK_YES`

### getEndTimeStamp

    public long getEndTimeStamp ()

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

Returns
`long` | End of interval.

### getMetered

    public int getMetered ()

Metered state. One of the following values:

- `METERED_ALL`
- `METERED_NO`
- `METERED_YES`

A network is classified as metered when the user is sensitive to heavy data usage on that connection. Apps may warn before using these networks for large downloads. The metered state can be set by the user within data usage network restrictions.

Returns
`int` | Value is `METERED_ALL`, `METERED_NO`, or `METERED_YES`

### getRoaming

    public int getRoaming ()

Roaming state. One of the following values:

- `ROAMING_ALL`
- `ROAMING_NO`
- `ROAMING_YES`

Returns
`int` | Value is `ROAMING_ALL`, `ROAMING_NO`, or `ROAMING_YES`

### getRxBytes

    public 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

    public 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

    public long getStartTimeStamp ()

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

Returns
`long` | Start of interval.

### getState

    public int getState ()

Usage state. One of the following values:

- `STATE_ALL`
- `STATE_DEFAULT`
- `STATE_FOREGROUND`

Returns
`int` | Usage state. Value is `STATE_ALL`, `STATE_DEFAULT`, or `STATE_FOREGROUND`

### getTag

    public int getTag ()

Tag of the bucket.

Returns
`int` | Bucket tag.

### getTxBytes

    public 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

    public 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

    public int getUid ()

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

- `UID_REMOVED`
- `UID_TETHERING`
- `Process.SYSTEM_UID`

Returns
`int` | Bucket key.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*