Alarm.Builder
@Document.BuilderProducer
public final class Alarm.Builder
Builder for Alarm.
Summary
Protected fields |
|
|---|---|
List<String> |
|
String |
|
String |
|
long |
|
int[] |
|
String |
|
int |
|
long |
|
boolean |
|
int |
|
final String |
|
String |
|
int |
|
String |
|
final String |
|
AlarmInstance |
|
int |
|
List<PotentialAction> |
|
AlarmInstance |
|
String |
|
boolean |
|
String |
Public constructors |
|---|
|
Constructor with all the existing values. |
|
Constructor for |
Public methods |
|
|---|---|
@NonNull T |
addAlternateName(@NonNull String alternateName)Adds an alias for the item. |
@NonNull T |
@ExperimentalAppSearchApiAdd a new action to the list of potential actions for this document. |
@NonNull Alarm |
build()Builds the |
@NonNull Thing |
build()Builds a |
@NonNull T |
Clears the aliases, if any, for the item. |
@NonNull T |
Clear all the potential actions for this document. |
@NonNull T |
setAlternateNames(@Nullable List<String> alternateNames)Sets a list of aliases for the item. |
@NonNull T |
setBlackoutPeriodEndDate(@Nullable String blackoutPeriodEndDate)Sets the end time for the blackout period in ISO 8601 format. |
@NonNull T |
setBlackoutPeriodStartDate(@Nullable String blackoutPeriodStartDate)Sets the start date for the blackout period in ISO 8601 format. |
@NonNull T |
setCreationTimestampMillis(long creationTimestampMillis)Sets the creation timestamp for the current AppSearch entity, in milliseconds using the |
@NonNull T |
setDaysOfWeek(Sets the scheduled days for repeating. |
@NonNull T |
setDescription(@Nullable String description)Sets the description for the item. |
@NonNull T |
setDocumentScore(int documentScore)Sets the user-provided opaque document score of the current AppSearch document, which can be used for ranking using |
@NonNull T |
setDocumentTtlMillis(long documentTtlMillis)Sets the time-to-live (TTL) for the current AppSearch document as a duration in milliseconds. |
@NonNull T |
setEnabled(boolean enabled)Sets whether or not the |
@NonNull T |
Sets the hour the |
@NonNull T |
Sets the URL for an image of the item. |
@NonNull T |
Sets the minute the |
@NonNull T |
Sets the name of the item. |
@NonNull T |
setNextInstance(@Nullable AlarmInstance nextInstance)Sets the next |
@NonNull T |
setOriginatingDevice(int originatingDevice)Sets the |
@NonNull T |
@ExperimentalAppSearchApiSets a list of potential actions for this document. |
@NonNull T |
setPreviousInstance(@Nullable AlarmInstance previousInstance)Sets the previous |
@NonNull T |
setRingtone(@Nullable String ringtone)Sets the content URI for the ringtone to be played, or |
@NonNull T |
setShouldVibrate(boolean shouldVibrate)Sets whether or not to activate the device vibrator when the |
@NonNull T |
Sets the deeplink URL of the item. |
Protected fields
Public constructors
Builder
public Builder(@NonNull Alarm alarm)
Constructor with all the existing values.
Builder
public Builder(@NonNull String namespace, @NonNull String id)
Constructor for Alarm.Builder.
| Parameters | |
|---|---|
@NonNull String namespace |
Namespace for the Document. See |
@NonNull String id |
Unique identifier for the Document. See |
Public methods
addAlternateName
public @NonNull T addAlternateName(@NonNull String alternateName)
Adds an alias for the item.
addPotentialAction
@ExperimentalAppSearchApi
public @NonNull T addPotentialAction(@NonNull PotentialAction newPotentialAction)
Add a new action to the list of potential actions for this document.
clearAlternateNames
public @NonNull T clearAlternateNames()
Clears the aliases, if any, for the item.
clearPotentialActions
@ExperimentalAppSearchApi
public @NonNull T clearPotentialActions()
Clear all the potential actions for this document.
setAlternateNames
public @NonNull T setAlternateNames(@Nullable List<String> alternateNames)
Sets a list of aliases for the item.
setBlackoutPeriodEndDate
public @NonNull T setBlackoutPeriodEndDate(@Nullable String blackoutPeriodEndDate)
Sets 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.
setBlackoutPeriodStartDate
public @NonNull T setBlackoutPeriodStartDate(@Nullable String blackoutPeriodStartDate)
Sets the start date 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 start time.
If neither blackoutPeriodStartDate and blackoutPeriodEndDate are set, then the blackout period is not defined.
setCreationTimestampMillis
public @NonNull T setCreationTimestampMillis(long creationTimestampMillis)
Sets the creation timestamp for the current AppSearch entity, in milliseconds using the currentTimeMillis time base.
This timestamp refers to the creation time of the AppSearch entity, not when the document is written into AppSearch.
If not set, then the current timestamp will be used.
See androidx.appsearch.annotation.Document.CreationTimestampMillis for more information on creation timestamp.
setDaysOfWeek
public @NonNull T setDaysOfWeek(
@IntRange(from = Calendar.SUNDAY, to = Calendar.SATURDAY) @Nullable int[] daysOfWeek
)
Sets the scheduled days for repeating.
Days of the week can be MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, or SUNDAY.
If not set, or if the list is empty, then the Alarm does not repeat.
setDescription
public @NonNull T setDescription(@Nullable String description)
Sets the description for the item.
setDocumentScore
public @NonNull T setDocumentScore(int documentScore)
Sets the user-provided opaque document score of the current AppSearch document, which can be used for ranking using RANKING_STRATEGY_DOCUMENT_SCORE.
See androidx.appsearch.annotation.Document.Score for more information on score.
setDocumentTtlMillis
public @NonNull T setDocumentTtlMillis(long documentTtlMillis)
Sets the time-to-live (TTL) for the current AppSearch document as a duration in milliseconds.
The document will be automatically deleted when the TTL expires.
If not set, then the document will never expire.
See androidx.appsearch.annotation.Document.TtlMillis for more information on TTL.
setEnabled
public @NonNull T setEnabled(boolean enabled)
Sets whether or not the Alarm is active.
setHour
public @NonNull T setHour(@IntRange(from = 0, to = 23) int hour)
Sets the hour the Alarm will fire.
Hours are specified by integers from 0 to 23.
setImage
@ExperimentalAppSearchApi
public @NonNull T setImage(@Nullable String image)
Sets the URL for an image of the item.
setMinute
public @NonNull T setMinute(@IntRange(from = 0, to = 59) int minute)
Sets the minute the Alarm will fire.
Minutes are specified by integers from 0 to 59.
setNextInstance
public @NonNull T setNextInstance(@Nullable AlarmInstance nextInstance)
Sets the next AlarmInstance.
The next AlarmInstance is the immediate future instance that is scheduled to fire. If not set, then there are no future instances.
See AlarmInstance.
setOriginatingDevice
public @NonNull T setOriginatingDevice(int originatingDevice)
Sets the OriginatingDevice this alarm belongs to.
setPotentialActions
@ExperimentalAppSearchApi
public @NonNull T setPotentialActions(@Nullable List<PotentialAction> newPotentialActions)
Sets a list of potential actions for this document.
setPreviousInstance
public @NonNull T setPreviousInstance(@Nullable AlarmInstance previousInstance)
Sets the previous AlarmInstance.
The previous AlarmInstance is most recent past instance that was fired. If not set, then there are no past instances.
See AlarmInstance.
setRingtone
public @NonNull T setRingtone(@Nullable String ringtone)
Sets the content URI for the ringtone to be played, or VALUE_RINGTONE_SILENT if no ringtone will be played.
setShouldVibrate
public @NonNull T setShouldVibrate(boolean shouldVibrate)
Sets whether or not to activate the device vibrator when the Alarm fires.
setUrl
public @NonNull T setUrl(@Nullable String url)
Sets the deeplink URL of the item.
If this item can be displayed by any system UI surface, or can be read by another Android package, through one of the androidx.appsearch.app.SetSchemaRequest.Builder methods, this url should act as a deeplink into the activity that can open it. Callers should be able to construct an ACTION_VIEW intent with the url as the setData to view the item inside your application.
See Allowing Other Apps to Start Your Activity for more details on how to make activities in your app open for use by other apps by defining intent filters.