public final class ConversationAction


Represents an action suggested by a TextClassifier on a given conversation.

Summary

Nested types

public final class ConversationAction.Builder

This class is deprecated.

Use android.view.textclassifier.ConversationAction.Builder instead.

Constants

static final String
TYPE_ADD_CONTACT = "add_contact"

Indicates an action to add a contact.

static final String
TYPE_CALL_PHONE = "call_phone"

Indicates an action to call a phone number.

static final String
TYPE_COPY = "copy"

Indicates an action to copy a code.

static final String
TYPE_CREATE_REMINDER = "create_reminder"

Indicates an action to create a reminder.

static final String
TYPE_OPEN_URL = "open_url"

Indicates an action to open an URL.

static final String
TYPE_SEND_EMAIL = "send_email"

Indicates an action to send an email.

static final String
TYPE_SEND_SMS = "send_sms"

Indicates an action to send a SMS.

static final String
TYPE_SHARE_LOCATION = "share_location"

Indicates an action to reply with a location.

static final String
TYPE_TEXT_REPLY = "text_reply"

Indicates an action to reply with a text message.

static final String
TYPE_TRACK_FLIGHT = "track_flight"

Indicates an action to track a flight.

static final String
TYPE_VIEW_CALENDAR = "view_calendar"

Indicates an action to view a calendar at a specified time.

static final String
TYPE_VIEW_MAP = "view_map"

Indicates an action to view the map at a specified location.

Public methods

static @NonNull ConversationAction

Converts a bundle that was created using toBundle to a ConversationAction.

@Nullable RemoteActionCompat

Returns a RemoteActionCompat object, which contains the icon, label and a PendingIntent, for the specified action type.

@FloatRange(from = 0, to = 1) float

Returns the confidence score for the specified action.

@NonNull Bundle

Returns the extended data related to this conversation action.

@Nullable CharSequence

Returns the text reply that could be sent as a reply to the given conversation.

@NonNull String

Returns the type of this action, for example, TYPE_VIEW_CALENDAR.

@NonNull Bundle

Adds this object to a Bundle that can be read back with the same parameters to createFromBundle.

Constants

TYPE_ADD_CONTACT

public static final String TYPE_ADD_CONTACT = "add_contact"

Indicates an action to add a contact.

TYPE_CALL_PHONE

public static final String TYPE_CALL_PHONE = "call_phone"

Indicates an action to call a phone number.

TYPE_COPY

public static final String TYPE_COPY = "copy"

Indicates an action to copy a code.

TYPE_CREATE_REMINDER

public static final String TYPE_CREATE_REMINDER = "create_reminder"

Indicates an action to create a reminder.

TYPE_OPEN_URL

public static final String TYPE_OPEN_URL = "open_url"

Indicates an action to open an URL.

TYPE_SEND_EMAIL

public static final String TYPE_SEND_EMAIL = "send_email"

Indicates an action to send an email.

TYPE_SEND_SMS

public static final String TYPE_SEND_SMS = "send_sms"

Indicates an action to send a SMS.

TYPE_SHARE_LOCATION

public static final String TYPE_SHARE_LOCATION = "share_location"

Indicates an action to reply with a location.

TYPE_TEXT_REPLY

public static final String TYPE_TEXT_REPLY = "text_reply"

Indicates an action to reply with a text message.

TYPE_TRACK_FLIGHT

public static final String TYPE_TRACK_FLIGHT = "track_flight"

Indicates an action to track a flight.

TYPE_VIEW_CALENDAR

public static final String TYPE_VIEW_CALENDAR = "view_calendar"

Indicates an action to view a calendar at a specified time.

TYPE_VIEW_MAP

public static final String TYPE_VIEW_MAP = "view_map"

Indicates an action to view the map at a specified location.

Public methods

createFromBundle

public static @NonNull ConversationAction createFromBundle(@NonNull Bundle bundle)

Converts a bundle that was created using toBundle to a ConversationAction.

getAction

public @Nullable RemoteActionCompat getAction()

Returns a RemoteActionCompat object, which contains the icon, label and a PendingIntent, for the specified action type.

getConfidenceScore

public @FloatRange(from = 0, to = 1) float getConfidenceScore()

Returns the confidence score for the specified action. The value ranges from 0 (low confidence) to 1 (high confidence).

getExtras

public @NonNull Bundle getExtras()

Returns the extended data related to this conversation action.

NOTE: Each call to this method returns a new bundle copy so clients should prefer to hold a reference to the returned bundle rather than frequently calling this method.

getTextReply

public @Nullable CharSequence getTextReply()

Returns the text reply that could be sent as a reply to the given conversation.

This is only available when the type of the action is TYPE_TEXT_REPLY.

getType

public @NonNull String getType()

Returns the type of this action, for example, TYPE_VIEW_CALENDAR.

toBundle

public @NonNull Bundle toBundle()

Adds this object to a Bundle that can be read back with the same parameters to createFromBundle.