# 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
public class Timer.BuilderBase<T extends Timer.BuilderBase<T>> extends Thing.BuilderBase<T>
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.appsearch.builtintypes.Thing.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase)\<T\> ||
|   | ↳ | [androidx.appsearch.builtintypes.Timer.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase) |

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

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

*** ** * ** ***

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#BuilderBase(androidx.appsearch.builtintypes.Timer)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer timer)` Constructor for `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase` with all the existing values. |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#BuilderBase(java.lang.String,java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html namespace, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html id)` Constructor for `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase`. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#build()()` Builds the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setBaseTimeMillis(long)(long baseTimeMillis)` Sets the point in time that the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer` counts down from, relative to its `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setRemainingDurationMillis(long)`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setBaseTimeMillis(long,long,int)( long baseTimeMillis, long baseTimeMillisInElapsedRealtime, int bootCount )` Sets the point in time that the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer` counts down from, relative to its `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setRemainingDurationMillis(long)`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setBaseTimeMillis(android.content.Context,long,long)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, long baseTimeMillis, long baseTimeMillisInElapsedRealtime )` Sets the point in time that the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer` counts down from, relative to its `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setRemainingDurationMillis(long)`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setBaseTimeMillisInElapsedRealtime(long)( long baseTimeMillisInElapsedRealtime )` Sets the point in time that the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer` counts down from, relative to its `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setRemainingDurationMillis(long)`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setBootCount(int)(int bootCount)` Sets the boot count of the device. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setDurationMillis(long)(long durationMillis)` Sets the total duration in milliseconds, including additional time added by the user. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setOriginalDurationMillis(long)(long originalDurationMillis)` Sets the original duration in milliseconds when the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer` was first created. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setRemainingDurationMillis(long)(long remainingDurationMillis)` Sets the amount of time remaining in milliseconds for the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer` relative to its `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setBaseTimeMillis(long,long,int)`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setRingtone(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html ringtone)` 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. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setShouldVibrate(boolean)(boolean shouldVibrate)` Sets whether or not to activate the device vibrator when the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer` expires. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setStartTimeMillis(long)(long startTimeMillis)` Sets the start time in milliseconds using the `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` time base. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase#setStatus(int)(int status)` Sets the current status. |

### Inherited methods

From [androidx.appsearch.builtintypes.Thing.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase) `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#addAlternateName(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html alternateName)`

Adds an alias for the item.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `@https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi
https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#addPotentialAction(androidx.appsearch.builtintypes.PotentialAction)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/builtintypes/PotentialAction newPotentialAction)`

Add a new action to the list of potential actions for this document.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#clearAlternateNames()()`

Clears the aliases, if any, for the item.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `@https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi
https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#clearPotentialActions()()`

Clear all the potential actions for this document.
`void` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#resetIfBuilt()()`

If built, make a copy of previous data for every field so that the builder can be reused.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setAlternateNames(java.util.List<java.lang.String>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html> alternateNames)`

Sets a list of aliases for the item.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setCreationTimestampMillis(long)(long creationTimestampMillis)`

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.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setDescription(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html description)`

Sets the description for the item.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setDocumentScore(int)(int documentScore)`

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

Sets the time-to-live (TTL) for the current AppSearch document as a duration in milliseconds.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `@https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi
https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setImage(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html image)`

Sets the URL for an image of the item.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setName(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html name)`

Sets the name of the item.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `@https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi
https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setPotentialActions(java.util.List<androidx.appsearch.builtintypes.PotentialAction>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/appsearch/builtintypes/PotentialAction> newPotentialActions)`

Sets a list of potential actions for this document.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setUrl(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html url)`

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)

```
public BuilderBase(@NonNull Timer timer)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer timer` | The existing `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer` to copy values from. |

### BuilderBase

```
public BuilderBase(@NonNull String namespace, @NonNull String id)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html namespace` | Namespace for the Document. See `https://developer.android.com/reference/androidx/appsearch/annotation/Document.Namespace`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html id` | Unique identifier for the Document. See `https://developer.android.com/reference/androidx/appsearch/annotation/Document.Id`. |

## Public methods

### build

```
public @NonNull Timer build()
```

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

### setBaseTimeMillis

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

```
public @NonNull T setBaseTimeMillis(long baseTimeMillis)
```

Sets the point in time that the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer` counts down from, relative to its `https://developer.android.com/reference/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)

```
public @NonNull T setBaseTimeMillis(
    long baseTimeMillis,
    long baseTimeMillisInElapsedRealtime,
    int bootCount
)
```

Sets the point in time that the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer` counts down from, relative to its `https://developer.android.com/reference/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 |
|---|---|
| `long baseTimeMillis` | The base time in milliseconds using the `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` time base. |
| `long baseTimeMillisInElapsedRealtime` | The base time in milliseconds using the `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()` time base. |
| `int bootCount` | 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)

```
public @NonNull T setBaseTimeMillis(
    @NonNull Context context,
    long baseTimeMillis,
    long baseTimeMillisInElapsedRealtime
)
```

Sets the point in time that the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer` counts down from, relative to its `https://developer.android.com/reference/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/androidx/appsearch/builtintypes/Timer.BuilderBase#setBaseTimeMillis(long,long,int)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | The app context used to fetch boot count. |
| `long baseTimeMillis` | The base time in milliseconds using the `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` time base. |
| `long baseTimeMillisInElapsedRealtime` | 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)

```
public @NonNull T setBaseTimeMillisInElapsedRealtime(
    long baseTimeMillisInElapsedRealtime
)
```

Sets the point in time that the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer` counts down from, relative to its `https://developer.android.com/reference/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)

```
public @NonNull T setBootCount(int bootCount)
```

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)

```
public @NonNull T setDurationMillis(long durationMillis)
```

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)

```
public @NonNull T setOriginalDurationMillis(long originalDurationMillis)
```

Sets the original duration in milliseconds when the `https://developer.android.com/reference/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)

```
public @NonNull T setRemainingDurationMillis(long remainingDurationMillis)
```

Sets the amount of time remaining in milliseconds for the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer` relative to its `https://developer.android.com/reference/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)

```
public @NonNull T setRingtone(@Nullable String ringtone)
```

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)

```
public @NonNull T setShouldVibrate(boolean shouldVibrate)
```

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

### setStartTimeMillis

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

```
public @NonNull T setStartTimeMillis(long startTimeMillis)
```

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)

```
public @NonNull T setStatus(int status)
```

Sets the current status.

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