# Timer.BuilderBase

Artifact: [androidx.appsearch:appsearch-builtin-types](https://developer.android.com/jetpack/androidx/releases/appsearch) [View Source](https://cs.android.com/search?q=file:androidx/appsearch/builtintypes/Timer.java+class:androidx.appsearch.builtintypes.Timer.BuilderBase) Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

*** ** * ** ***


```
@ExperimentalAppSearchApi
class Timer.BuilderBase<T : Timer.BuilderBase<T!>?> : Thing.BuilderBase<T!>
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.appsearch.builtintypes.Thing.BuilderBase](https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase)\<T!\> ||
|   | ↳ | [androidx.appsearch.builtintypes.Timer.BuilderBase](https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase) |

Known direct subclasses [Timer.Builder](https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.Builder)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.Builder` | Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer`. |

*** ** * ** ***

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#BuilderBase(androidx.appsearch.builtintypes.Timer)(timer: https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer)` Constructor for `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase` with all the existing values. |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#BuilderBase(java.lang.String,java.lang.String)(namespace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Constructor for `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase`. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` | `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#build()()` Builds the `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer`. |
| `T` | `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setBaseTimeMillis(long)(baseTimeMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the point in time that the `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` counts down from, relative to its `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setRemainingDurationMillis(long)`. |
| `T` | `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setBaseTimeMillis(long,long,int)( baseTimeMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, baseTimeMillisInElapsedRealtime: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, bootCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Sets the point in time that the `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` counts down from, relative to its `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setRemainingDurationMillis(long)`. |
| `T` | `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setBaseTimeMillis(android.content.Context,long,long)( context: https://developer.android.com/reference/android/content/Context.html, baseTimeMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, baseTimeMillisInElapsedRealtime: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html )` Sets the point in time that the `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` counts down from, relative to its `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setRemainingDurationMillis(long)`. |
| `T` | `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setBaseTimeMillisInElapsedRealtime(long)( baseTimeMillisInElapsedRealtime: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html )` Sets the point in time that the `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` counts down from, relative to its `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setRemainingDurationMillis(long)`. |
| `T` | `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setBootCount(int)(bootCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the boot count of the device. |
| `T` | `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setDurationMillis(long)(durationMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the total duration in milliseconds, including additional time added by the user. |
| `T` | `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setOriginalDurationMillis(long)(originalDurationMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the original duration in milliseconds when the `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` was first created. |
| `T` | `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setRemainingDurationMillis(long)(remainingDurationMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the amount of time remaining in milliseconds for the `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` relative to its `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setBaseTimeMillis(long,long,int)`. |
| `T` | `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setRingtone(java.lang.String)(ringtone: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` Sets the content URI for the ringtone to be played, or `https://developer.android.com/reference/android/provider/AlarmClock.html#VALUE_RINGTONE_SILENT` if no ringtone will be played. |
| `T` | `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setShouldVibrate(boolean)(shouldVibrate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether or not to activate the device vibrator when the `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` expires. |
| `T` | `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setStartTimeMillis(long)(startTimeMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the start time in milliseconds using the `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` time base. |
| `T` | `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setStatus(int)(status: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the current status. |

### Inherited functions

From [androidx.appsearch.builtintypes.Thing.BuilderBase](https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase) `T` `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase#addAlternateName(java.lang.String)(alternateName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`

Adds an alias for the item.
`T` `@https://developer.android.com/reference/kotlin/androidx/appsearch/app/ExperimentalAppSearchApi
https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase#addPotentialAction(androidx.appsearch.builtintypes.PotentialAction)(newPotentialAction: https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/PotentialAction)`

Add a new action to the list of potential actions for this document.
`T` `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase#clearAlternateNames()()`

Clears the aliases, if any, for the item.
`T` `@https://developer.android.com/reference/kotlin/androidx/appsearch/app/ExperimentalAppSearchApi
https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase#clearPotentialActions()()`

Clear all the potential actions for this document.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase#resetIfBuilt()()`

If built, make a copy of previous data for every field so that the builder can be reused.
`T` `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase#setAlternateNames(java.util.List<java.lang.String>)(alternateNames: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>?)`

Sets a list of aliases for the item.
`T` `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase#setCreationTimestampMillis(long)(creationTimestampMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Sets the creation timestamp for the current AppSearch entity, in milliseconds using the `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` time base.
`T` `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase#setDescription(java.lang.String)(description: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)`

Sets the description for the item.
`T` `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase#setDocumentScore(int)(documentScore: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets the user-provided opaque document score of the current AppSearch document, which can be used for ranking using `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SearchSpec#RANKING_STRATEGY_DOCUMENT_SCORE()`.
`T` `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase#setDocumentTtlMillis(long)(documentTtlMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Sets the time-to-live (TTL) for the current AppSearch document as a duration in milliseconds.
`T` `@https://developer.android.com/reference/kotlin/androidx/appsearch/app/ExperimentalAppSearchApi
https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase#setImage(java.lang.String)(image: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)`

Sets the URL for an image of the item.
`T` `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase#setName(java.lang.String)(name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)`

Sets the name of the item.
`T` `@https://developer.android.com/reference/kotlin/androidx/appsearch/app/ExperimentalAppSearchApi
https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase#setPotentialActions(java.util.List<androidx.appsearch.builtintypes.PotentialAction>)(
newPotentialActions: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/PotentialAction!>?
)`

Sets a list of potential actions for this document.
`T` `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase#setUrl(java.lang.String)(url: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)`

Sets the deeplink URL of the item.

## Public constructors

### BuilderBase

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
BuilderBase(timer: Timer)
```

Constructor for `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase` with all the existing values.

| Parameters |
|---|---|
| `timer: https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` | The existing `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` to copy values from. |

### BuilderBase

```
BuilderBase(namespace: String, id: String)
```

Constructor for `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase`.

| Parameters |
|---|---|
| `namespace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Namespace for the Document. See `https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document.Namespace`. |
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Unique identifier for the Document. See `https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document.Id`. |

## Public functions

### build

```
fun build(): Timer
```

Builds the `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer`.

### setBaseTimeMillis

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
fun setBaseTimeMillis(baseTimeMillis: Long): T
```

Sets the point in time that the `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` counts down from, relative to its `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setRemainingDurationMillis(long)`. In milliseconds using the `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` time base.

### setBaseTimeMillis

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
fun setBaseTimeMillis(
    baseTimeMillis: Long,
    baseTimeMillisInElapsedRealtime: Long,
    bootCount: Int
): T
```

Sets the point in time that the `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` counts down from, relative to its `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setRemainingDurationMillis(long)`.

The expire time of the Timer can be calculated using the sum of its base time and remaining time.

Base time should be sampled in both the `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` and `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()` time base. In addition, the boot count of the device is needed to check if the `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()` time base is valid.

| Parameters |
|---|---|
| `baseTimeMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The base time in milliseconds using the `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` time base. |
| `baseTimeMillisInElapsedRealtime: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The base time in milliseconds using the `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()` time base. |
| `bootCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The current boot count of the device. See `https://developer.android.com/reference/android/provider/Settings.Global.html#BOOT_COUNT`. |

### setBaseTimeMillis

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
fun setBaseTimeMillis(
    context: Context,
    baseTimeMillis: Long,
    baseTimeMillisInElapsedRealtime: Long
): T
```

Sets the point in time that the `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` counts down from, relative to its `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setRemainingDurationMillis(long)`.

The expire time of the Timer can be calculated using the sum of its base time and remaining time.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setBaseTimeMillis(long,long,int)`.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | The app context used to fetch boot count. |
| `baseTimeMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The base time in milliseconds using the `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` time base. |
| `baseTimeMillisInElapsedRealtime: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The base time in milliseconds using the `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()` time base. |

### setBaseTimeMillisInElapsedRealtime

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
fun setBaseTimeMillisInElapsedRealtime(
    baseTimeMillisInElapsedRealtime: Long
): T
```

Sets the point in time that the `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` counts down from, relative to its `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setRemainingDurationMillis(long)`. In milliseconds using the `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()` time base.

### setBootCount

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
fun setBootCount(bootCount: Int): T
```

Sets the boot count of the device.

### setDurationMillis

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
fun setDurationMillis(durationMillis: Long): T
```

Sets the total duration in milliseconds, including additional time added by the user.

### setOriginalDurationMillis

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
fun setOriginalDurationMillis(originalDurationMillis: Long): T
```

Sets the original duration in milliseconds when the `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` was first created.

### setRemainingDurationMillis

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
fun setRemainingDurationMillis(remainingDurationMillis: Long): T
```

Sets the amount of time remaining in milliseconds for the `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` relative to its `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer.BuilderBase#setBaseTimeMillis(long,long,int)`.

The expire time of the Timer can be calculated using the sum of its base time and remaining time.

### setRingtone

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
fun setRingtone(ringtone: String?): T
```

Sets the content URI for the ringtone to be played, or `https://developer.android.com/reference/android/provider/AlarmClock.html#VALUE_RINGTONE_SILENT` if no ringtone will be played.

### setShouldVibrate

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
fun setShouldVibrate(shouldVibrate: Boolean): T
```

Sets whether or not to activate the device vibrator when the `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer` expires.

### setStartTimeMillis

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
fun setStartTimeMillis(startTimeMillis: Long): T
```

Sets the start time in milliseconds using the `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` time base.

The start time is the first time that a new Timer, or a Timer that has been reset is started. Pausing and resuming should not change its start time.

### setStatus

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
fun setStatus(status: Int): T
```

Sets the current status.

Status can be `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer#STATUS_UNKNOWN()`, `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer#STATUS_STARTED()`, `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer#STATUS_PAUSED()`, `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer#STATUS_EXPIRED()`, `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer#STATUS_MISSED()`, or `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Timer#STATUS_RESET()`.