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


AppSearch document representing an Alarm entity.

Summary

Nested types

Builder for Alarm.

Constants

static final int

The Alarm belongs to a smart phone device.

static final int

The Alarm belongs to a smart watch device.

static final int

The Alarm belongs to an unknown device.

Public methods

@Nullable String

Returns the end time for the blackout period in ISO 8601 format.

@Nullable String

Returns the start date of the blackout period in ISO 8601 format.

@Nullable int[]

Returns the scheduled days for repeating.

@IntRange(from = 0, to = 23) int

Returns the hour the Alarm will fire.

@IntRange(from = 0, to = 59) int

Returns the minute the Alarm will fire.

@Nullable AlarmInstance

Returns the next AlarmInstance.

int

Returns the OriginatingDevice this alarm belongs to.

@Nullable AlarmInstance

Returns the previous AlarmInstance.

@Nullable String

Returns the ringtone as a content URI to be played, or VALUE_RINGTONE_SILENT if no ringtone will be played.

boolean

Returns whether or not the Alarm is active.

boolean

Returns whether or not to activate the device vibrator when the Alarm fires.

Inherited methods

From androidx.appsearch.builtintypes.Thing
@NonNull List<String>

Returns an unmodifiable list of aliases, if any, for this item.

long

Returns the creation timestamp, in milliseconds since Unix epoch, of this item.

@Nullable String

Returns a description of this item.

int

Returns the intrinsic score (or importance) of this item.

long

Returns the time-to-live timestamp, in milliseconds since getCreationTimestampMillis, for this item.

@NonNull String

Returns the unique identifier for this item.

@Nullable String

Returns the URL for an image of this item.

@Nullable String

Returns the name of this item.

@NonNull String

Returns the namespace (or logical grouping) for this item.

@NonNull List<PotentialAction>

Returns the actions that can be taken on this object.

@Nullable String

Returns the deeplink URL of this item.

Constants

ORIGINATING_DEVICE_SMART_PHONE

Added in 1.1.0-alpha07
public static final int ORIGINATING_DEVICE_SMART_PHONE = 1

The Alarm belongs to a smart phone device.

ORIGINATING_DEVICE_SMART_WATCH

Added in 1.1.0-alpha07
public static final int ORIGINATING_DEVICE_SMART_WATCH = 2

The Alarm belongs to a smart watch device.

ORIGINATING_DEVICE_UNKNOWN

Added in 1.1.0-alpha07
public static final int ORIGINATING_DEVICE_UNKNOWN = 0

The Alarm belongs to an unknown device.

Public methods

getBlackoutPeriodEndDate

Added in 1.1.0-alpha07
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 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-alpha07
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 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-alpha07
public @Nullable int[] getDaysOfWeek()

Returns the scheduled days for repeating.

Days of the week can be MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, or SUNDAY.

If null, or if the list is empty, then the Alarm does not repeat.

getHour

Added in 1.1.0-alpha07
public @IntRange(from = 0, to = 23) int getHour()

Returns the hour the Alarm will fire.

Hours are specified by integers from 0 to 23.

getMinute

Added in 1.1.0-alpha07
public @IntRange(from = 0, to = 59) int getMinute()

Returns the minute the Alarm will fire.

Minutes are specified by integers from 0 to 59.

getNextInstance

Added in 1.1.0-alpha07
public @Nullable AlarmInstance getNextInstance()

Returns the next AlarmInstance.

The next AlarmInstance is the immediate future instance that is scheduled to fire. If there are no future instances, then null will be returned.

See AlarmInstance.

getOriginatingDevice

Added in 1.1.0-alpha07
public int getOriginatingDevice()

Returns the OriginatingDevice this alarm belongs to.

getPreviousInstance

Added in 1.1.0-alpha07
public @Nullable AlarmInstance getPreviousInstance()

Returns the previous AlarmInstance.

The previous AlarmInstance is most recent past instance that was fired. If there are no past instances, then null will be returned.

See AlarmInstance.

getRingtone

Added in 1.1.0-alpha07
public @Nullable String getRingtone()

Returns the ringtone as a content URI to be played, or VALUE_RINGTONE_SILENT if no ringtone will be played.

isEnabled

Added in 1.1.0-alpha07
public boolean isEnabled()

Returns whether or not the Alarm is active.

shouldVibrate

Added in 1.1.0-alpha07
public boolean shouldVibrate()

Returns whether or not to activate the device vibrator when the Alarm fires.