AppUsageDurationQuery.Builder


public static final class AppUsageDurationQuery.Builder
extends Object

java.lang.Object
   ↳ android.app.usage.AppUsageDurationQuery.Builder


Builder for AppUsageDurationQuery.

Summary

Public constructors

Builder(long startTimeMillis, long endTimeMillis, int intervalType)

Constructor that specifies the period for which to return events.

Public methods

AppUsageDurationQuery build()

Builds a read-only AppUsageDurationQuery object.

AppUsageDurationQuery.Builder setEndTimeMillis(long endTimeMillis)

Sets the exclusive end timestamp.

AppUsageDurationQuery.Builder setIntervalType(int intervalType)

Sets the time interval by which the stats are aggregated.

AppUsageDurationQuery.Builder setStartTimeMillis(long startTimeMillis)

Sets the inclusive start timestamp.

Inherited methods

Public constructors

Builder

Added in API level 10000
public Builder (long startTimeMillis, 
                long endTimeMillis, 
                int intervalType)

Constructor that specifies the period for which to return events.

Parameters
startTimeMillis long: inclusive start timestamp, as per System.currentTimeMillis()
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z.

endTimeMillis long: exclusive end timestamp, as per System.currentTimeMillis()
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z.

intervalType int: time interval by which the stats are aggregated.
Value is one of the following:
Throws
IllegalArgumentException if endTimeMillis < startTimeMillis or if startTimeMillis is negative, or if intervalType is invalid.

Public methods

build

Added in API level 10000
public AppUsageDurationQuery build ()

Builds a read-only AppUsageDurationQuery object.

Returns
AppUsageDurationQuery This value cannot be null.

setEndTimeMillis

Added in API level 10000
public AppUsageDurationQuery.Builder setEndTimeMillis (long endTimeMillis)

Sets the exclusive end timestamp.

Parameters
endTimeMillis long: exclusive end timestamp, as per System.currentTimeMillis()
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z.

Returns
AppUsageDurationQuery.Builder this Builder object.
This value cannot be null.

setIntervalType

Added in API level 10000
public AppUsageDurationQuery.Builder setIntervalType (int intervalType)

Sets the time interval by which the stats are aggregated.

Parameters
intervalType int: time interval by which the stats are aggregated.
Value is one of the following:
Returns
AppUsageDurationQuery.Builder this Builder object.
This value cannot be null.

setStartTimeMillis

Added in API level 10000
public AppUsageDurationQuery.Builder setStartTimeMillis (long startTimeMillis)

Sets the inclusive start timestamp.

Parameters
startTimeMillis long: inclusive start timestamp, as per System.currentTimeMillis()
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z.

Returns
AppUsageDurationQuery.Builder this Builder object.
This value cannot be null.