TakenAction


@Document(name = "builtin:TakenAction")
@ExperimentalAppSearchApi
abstract class TakenAction

Known direct subclasses
ClickAction

ClickAction is a built-in AppSearch document type that contains different metrics.

DismissAction

DismissAction is a built-in AppSearch document type that contains different metrics.

ImpressionAction

ImpressionAction is a built-in AppSearch document type that contains different metrics.

SearchAction

SearchAction is a built-in AppSearch document type that contains different metrics.


TakenAction is an abstract class which holds common fields of other AppSearch built-in action types (e.g. SearchAction, ClickAction).

Clients can report the user's actions by creating concrete actions with addTakenActions API.

Summary

Public constructors

Constructs a TakenAction from a BuilderBase.

Public functions

Long

Returns the timestamp when the user took the action, in milliseconds since Unix epoch.

Int

Returns the action type of the TakenAction.

Long

Returns the time-to-live (TTL) of the TakenAction document as a duration in milliseconds.

String

Returns the unique identifier of the TakenAction.

String

Returns the namespace of the TakenAction.

Public constructors

TakenAction

Added in 1.2.0-alpha02
@ExperimentalAppSearchApi
TakenAction(builder: TakenAction.BuilderBase<*>)

Constructs a TakenAction from a BuilderBase.

Parameters
builder: TakenAction.BuilderBase<*>

The builder to construct the TakenAction from.

Public functions

getActionTimestampMillis

Added in 1.1.0
fun getActionTimestampMillis(): Long

Returns the timestamp when the user took the action, in milliseconds since Unix epoch.

The action timestamp will be used together with getDocumentTtlMillis as the document retention.

getActionType

Added in 1.2.0-alpha02
@ExperimentalAppSearchApi
fun getActionType(): Int

Returns the action type of the TakenAction.

getDocumentTtlMillis

Added in 1.1.0
fun getDocumentTtlMillis(): Long

Returns the time-to-live (TTL) of the TakenAction document as a duration in milliseconds.

The document will be automatically deleted when the TTL expires (since getActionTimestampMillis).

The default TTL for TakenAction document is 60 days.

See androidx.appsearch.annotation.Document.TtlMillis for more information on TTL.

getId

Added in 1.1.0
fun getId(): String

Returns the unique identifier of the TakenAction.

getNamespace

Added in 1.1.0
fun getNamespace(): String

Returns the namespace of the TakenAction.