Added in API level 23

NetworkStats


class NetworkStats : AutoCloseable
kotlin.Any
   ↳ android.app.usage.NetworkStats

Class providing enumeration over buckets of network usage statistics. NetworkStats objects are returned as results to various queries in NetworkStatsManager.

Summary

Nested classes

Buckets are the smallest elements of a query result.

Public methods
Unit

Closes the enumeration.

Boolean

Fills the recycled bucket with data of the next bin in the enumeration.

Boolean

Check if it is possible to ask for a next bucket in the enumeration.

Protected methods
Unit

Public methods

close

Added in API level 23
fun close(): Unit

Closes the enumeration. Call this method before this object gets out of scope.

Exceptions
java.lang.Exception if this resource cannot be closed

getNextBucket

Added in API level 23
fun getNextBucket(bucketOut: NetworkStats.Bucket?): Boolean

Fills the recycled bucket with data of the next bin in the enumeration.

Parameters
bucketOut NetworkStats.Bucket?: Bucket to be filled with data. If null, the method does nothing and returning false.
Return
Boolean true if successfully filled the bucket, false otherwise.

hasNextBucket

Added in API level 23
fun hasNextBucket(): Boolean

Check if it is possible to ask for a next bucket in the enumeration.

Return
Boolean true if there is at least one more bucket.

Protected methods

finalize

Added in API level 23
protected fun finalize(): Unit
Exceptions
java.lang.Throwable the Exception raised by this method