# Alarm

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/Alarm.java+class:androidx.appsearch.builtintypes.Alarm) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

*** ** * ** ***


```
@Document(name = "builtin:Alarm")
public class Alarm extends Thing
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.appsearch.builtintypes.Thing](https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing) ||
|   | ↳ | [androidx.appsearch.builtintypes.Alarm](https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm) |

*** ** * ** ***

AppSearch document representing an `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` entity.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/androidx/appsearch/annotation/Document.BuilderProducer public final class https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm.Builder extends https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm.BuilderBase<https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm.Builder>` Builder for `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm`. |
| `@https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi public class https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm.BuilderBase<T extends https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm.BuilderBase<T>> extends https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase<T>` |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm#ORIGINATING_DEVICE_SMART_PHONE() = 1` The `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` belongs to a smart phone device. |
| `static final int` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm#ORIGINATING_DEVICE_SMART_WATCH() = 2` The `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` belongs to a smart watch device. |
| `static final int` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm#ORIGINATING_DEVICE_UNKNOWN() = 0` The `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` belongs to an unknown device. |

| ### Public constructors |
|---|
| `@https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm#Alarm(androidx.appsearch.builtintypes.Alarm.BuilderBase<?>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm.BuilderBase<@https://developer.android.com/reference/androidx/annotation/NonNull ?> builder)` Constructor for `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm`. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm#getBlackoutPeriodEndDate()()` Returns the end time for the blackout period in ISO 8601 format. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm#getBlackoutPeriodStartDate()()` Returns the start date of the blackout period in ISO 8601 format. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html int[]` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm#getDaysOfWeek()()` Returns the scheduled days for repeating. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0, to = 23) int` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm#getHour()()` Returns the hour the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` will fire. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0, to = 59) int` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm#getMinute()()` Returns the minute the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` will fire. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/appsearch/builtintypes/AlarmInstance` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm#getNextInstance()()` Returns the next `https://developer.android.com/reference/androidx/appsearch/builtintypes/AlarmInstance`. |
| `int` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm#getOriginatingDevice()()` Returns the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm.OriginatingDevice` this alarm belongs to. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/appsearch/builtintypes/AlarmInstance` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm#getPreviousInstance()()` Returns the previous `https://developer.android.com/reference/androidx/appsearch/builtintypes/AlarmInstance`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm#getRingtone()()` Returns the ringtone as a content URI to be played, or `https://developer.android.com/reference/android/provider/AlarmClock.html#VALUE_RINGTONE_SILENT` if no ringtone will be played. |
| `boolean` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm#isEnabled()()` Returns whether or not the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` is active. |
| `boolean` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm#shouldVibrate()()` Returns whether or not to activate the device vibrator when the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` fires. |

### Inherited methods

From [androidx.appsearch.builtintypes.Thing](https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing) `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html>` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing#getAlternateNames()()`

Returns an unmodifiable list of aliases, if any, for this item.
`long` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing#getCreationTimestampMillis()()`

Returns the creation timestamp, in milliseconds since Unix epoch, of this item.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing#getDescription()()`

Returns a description of this item.
`int` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing#getDocumentScore()()`

Returns the intrinsic score (or importance) of this item.
`long` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing#getDocumentTtlMillis()()`

Returns the time-to-live timestamp, in milliseconds since `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing#getCreationTimestampMillis()`, for this item.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing#getId()()`

Returns the unique identifier for this item.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` `@https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi
https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing#getImage()()`

Returns the URL for an image of this item.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing#getName()()`

Returns the name of this item.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing#getNamespace()()`

Returns the namespace (or logical grouping) for this item.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/appsearch/builtintypes/PotentialAction>` `@https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi
https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing#getPotentialActions()()`

Returns the actions that can be taken on this object.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing#getUrl()()`

Returns the deeplink URL of this item.

## Constants

### ORIGINATING_DEVICE_SMART_PHONE

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

```
public static final int ORIGINATING_DEVICE_SMART_PHONE = 1
```

The `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` belongs to a smart phone device.

### ORIGINATING_DEVICE_SMART_WATCH

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

```
public static final int ORIGINATING_DEVICE_SMART_WATCH = 2
```

The `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` belongs to a smart watch device.

### ORIGINATING_DEVICE_UNKNOWN

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

```
public static final int ORIGINATING_DEVICE_UNKNOWN = 0
```

The `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` belongs to an unknown device.

## Public constructors

### Alarm

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

```
@ExperimentalAppSearchApi
public Alarm(@NonNull Alarm.BuilderBase<@NonNull ?> builder)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm.BuilderBase<@https://developer.android.com/reference/androidx/annotation/NonNull ?> builder` | The builder to construct the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` from. |

## Public methods

### getBlackoutPeriodEndDate

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

```
public @Nullable String getBlackoutPeriodEndDate()
```

Returns the end time for the blackout period in ISO 8601 format. E.g.: 2022-01-14

A blackout period means the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` will not fire during this period.

If not set, then it indicates that the blackout period has no end time.

If neither blackoutPeriodStartDate and blackoutPeriodEndDate are set, then the blackout period is not defined.

### getBlackoutPeriodStartDate

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

```
public @Nullable String getBlackoutPeriodStartDate()
```

Returns the start date of the blackout period in ISO 8601 format. E.g.: 2022-01-14

A blackout period means the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` will not fire during this period.

If not set, then it indicates that the blackout period has no start time.

If neither blackoutPeriodStartDate and blackoutPeriodEndDate are set, then the blackout period is not defined.

### getDaysOfWeek

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

```
public @Nullable int[] getDaysOfWeek()
```

Returns the scheduled days for repeating.

Days of the week can be `https://developer.android.com/reference/java/util/Calendar.html#MONDAY`, `https://developer.android.com/reference/java/util/Calendar.html#TUESDAY`, `https://developer.android.com/reference/java/util/Calendar.html#WEDNESDAY`, `https://developer.android.com/reference/java/util/Calendar.html#THURSDAY`, `https://developer.android.com/reference/java/util/Calendar.html#FRIDAY`, `https://developer.android.com/reference/java/util/Calendar.html#SATURDAY`, or `https://developer.android.com/reference/java/util/Calendar.html#SUNDAY`.

If null, or if the list is empty, then the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` does not repeat.

### getHour

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

```
public @IntRange(from = 0, to = 23) int getHour()
```

Returns the hour the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` will fire.

Hours are specified by integers from 0 to 23.

### getMinute

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

```
public @IntRange(from = 0, to = 59) int getMinute()
```

Returns the minute the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` will fire.

Minutes are specified by integers from 0 to 59.

### getNextInstance

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

```
public @Nullable AlarmInstance getNextInstance()
```

Returns the next `https://developer.android.com/reference/androidx/appsearch/builtintypes/AlarmInstance`.

The next `https://developer.android.com/reference/androidx/appsearch/builtintypes/AlarmInstance` is the immediate future instance that is scheduled to fire. If there are no future instances, then null will be returned.

See `https://developer.android.com/reference/androidx/appsearch/builtintypes/AlarmInstance`.

### getOriginatingDevice

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

```
public int getOriginatingDevice()
```

Returns the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm.OriginatingDevice` this alarm belongs to.

### getPreviousInstance

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

```
public @Nullable AlarmInstance getPreviousInstance()
```

Returns the previous `https://developer.android.com/reference/androidx/appsearch/builtintypes/AlarmInstance`.

The previous `https://developer.android.com/reference/androidx/appsearch/builtintypes/AlarmInstance` is most recent past instance that was fired. If there are no past instances, then null will be returned.

See `https://developer.android.com/reference/androidx/appsearch/builtintypes/AlarmInstance`.

### getRingtone

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

```
public @Nullable String getRingtone()
```

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

### isEnabled

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

```
public boolean isEnabled()
```

Returns whether or not the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` is active.

### shouldVibrate

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

```
public boolean shouldVibrate()
```

Returns whether or not to activate the device vibrator when the `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm` fires.