AlarmInstance.Builder


@Document.BuilderProducer
public final class AlarmInstance.Builder


Builder for AlarmInstance.

Summary

Public constructors

Builder(@NonNull AlarmInstance alarmInstance)

Constructor for AlarmInstance.Builder with all the existing values.

Builder(
    @NonNull String namespace,
    @NonNull String id,
    @NonNull String scheduledTime
)

Constructor for AlarmInstance.Builder.

Public methods

@NonNull T

Adds an alias for the item.

@NonNull T

Add a new action to the list of potential actions for this document.

@NonNull AlarmInstance

Builds the AlarmInstance.

@NonNull Thing

Builds a Thing object.

@NonNull T

Clears the aliases, if any, for the item.

@NonNull T

Clear all the potential actions for this document.

@NonNull T

Sets a list of aliases for the item.

@NonNull T
setCreationTimestampMillis(long creationTimestampMillis)

Sets the creation timestamp for the current AppSearch entity, in milliseconds using the currentTimeMillis time base.

@NonNull T

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 RANKING_STRATEGY_DOCUMENT_SCORE.

@NonNull T
setDocumentTtlMillis(long documentTtlMillis)

Sets the time-to-live (TTL) for the current AppSearch document as a duration in milliseconds.

@NonNull T

Sets the URL for an image of the item.

@NonNull T

Sets the name of the item.

@NonNull T

Sets a list of potential actions for this document.

@NonNull T
setSnoozeDurationMillis(long snoozeDurationMillis)

Sets the length of time in milliseconds the AlarmInstance will remain snoozed before it fires again.

@NonNull T
setStatus(int status)

Sets the current status.

@NonNull T

Sets the deeplink URL of the item.

Protected fields

mAlternateNames

protected List<StringmAlternateNames

mCreationTimestampMillis

protected long mCreationTimestampMillis

mDescription

protected String mDescription

mDocumentScore

protected int mDocumentScore

mDocumentTtlMillis

protected long mDocumentTtlMillis

mId

protected final String mId

mImage

protected String mImage

mName

protected String mName

mNamespace

protected final String mNamespace

mPotentialActions

protected List<PotentialActionmPotentialActions

mScheduledTime

protected final String mScheduledTime

mSnoozeDurationMillis

protected long mSnoozeDurationMillis

mStatus

protected int mStatus

mUrl

protected String mUrl

Public constructors

Builder

Added in 1.1.0-alpha06
public Builder(@NonNull AlarmInstance alarmInstance)

Constructor for AlarmInstance.Builder with all the existing values.

Builder

Added in 1.1.0-alpha06
public Builder(
    @NonNull String namespace,
    @NonNull String id,
    @NonNull String scheduledTime
)

Constructor for AlarmInstance.Builder.

Parameters
@NonNull String namespace

Namespace for the Document. See Document.Namespace.

@NonNull String id

Unique identifier for the Document. See Document.Id.

@NonNull String scheduledTime

The time that this is expected to fire in ISO 8601 format. E.g.: 2022-01-14T00:00:00. Scheduled time should be timezone independent.

Public methods

addAlternateName

Added in 1.1.0-alpha06
public @NonNulladdAlternateName(@NonNull String alternateName)

Adds an alias for the item.

addPotentialAction

Added in 1.1.0-alpha06
public @NonNulladdPotentialAction(@NonNull PotentialAction newPotentialAction)

Add a new action to the list of potential actions for this document.

build

Added in 1.1.0-alpha06
public @NonNull AlarmInstance build()

Builds the AlarmInstance.

build

Added in 1.1.0-alpha06
public @NonNull Thing build()

Builds a Thing object.

clearAlternateNames

Added in 1.1.0-alpha06
public @NonNullclearAlternateNames()

Clears the aliases, if any, for the item.

clearPotentialActions

Added in 1.1.0-alpha06
public @NonNullclearPotentialActions()

Clear all the potential actions for this document.

setAlternateNames

Added in 1.1.0-alpha06
public @NonNullsetAlternateNames(@Nullable List<String> alternateNames)

Sets a list of aliases for the item.

setCreationTimestampMillis

Added in 1.1.0-alpha06
public @NonNullsetCreationTimestampMillis(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.

setDescription

Added in 1.1.0-alpha06
public @NonNullsetDescription(@Nullable String description)

Sets the description for the item.

setDocumentScore

Added in 1.1.0-alpha06
public @NonNullsetDocumentScore(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

Added in 1.1.0-alpha06
public @NonNullsetDocumentTtlMillis(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.

setImage

Added in 1.1.0-alpha06
public @NonNullsetImage(@Nullable String image)

Sets the URL for an image of the item.

setName

Added in 1.1.0-alpha06
public @NonNullsetName(@Nullable String name)

Sets the name of the item.

setPotentialActions

Added in 1.1.0-alpha06
public @NonNullsetPotentialActions(@Nullable List<PotentialAction> newPotentialActions)

Sets a list of potential actions for this document.

setSnoozeDurationMillis

Added in 1.1.0-alpha06
public @NonNullsetSnoozeDurationMillis(long snoozeDurationMillis)

Sets the length of time in milliseconds the AlarmInstance will remain snoozed before it fires again.

If not set, or set to -1, then it does not support snoozing.

setStatus

Added in 1.1.0-alpha06
public @NonNullsetStatus(int status)

Sets the current status.

Status can be either STATUS_UNKNOWN, STATUS_SCHEDULED, STATUS_FIRING, STATUS_DISMISSED, STATUS_SNOOZED, or STATUS_MISSED.

setUrl

Added in 1.1.0-alpha06
public @NonNullsetUrl(@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.