java.lang.Object | |
↳ | android.preview.support.wearable.notifications.RemoteInput |
A RemoteInput
object collects a response from users and sets the
response as an intent extra inside the PendingIntent
that is sent.
Always use RemoteInput.Builder
to create instances of this class.
See Receiving Voice Input from a Notification for more information on how to use this class.
The following example adds a RemoteInput
to a WearableNotifications.Action
,
sets the intent extra key as quick_reply
, and sets the label as Quick Reply
.
Users are prompted to input a response when they trigger the action. The results are sent as an
intent extra with the key of returnKey
in the action's
PendingIntent
.
public static final String EXTRA_QUICK_REPLY_TEXT = "quick_reply"; WearableNotifications.Action action = new WearableNotifications.Action.Builder( R.drawable.reply, "Reply", actionIntent) .addRemoteInput(new RemoteInput.Builder(EXTRA_QUICK_REPLY_TEXT) .setLabel("Quick reply").build()) .build();
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
RemoteInput.Builder | Builder class for RemoteInput objects. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.os.Parcelable
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CREATOR | |||||||||||
allowFreeFormInput | Indicates whether or not users can provide an arbitrary value for input. | ||||||||||
choices | Possible input choices. | ||||||||||
label | The label to display to users when collecting this input. | ||||||||||
returnKey | The lookup key for the intent extra that the response is set in. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
android.os.Parcelable
|
Indicates whether or not users can provide an arbitrary value for
input. If you set this to false
, users must select one of the
provided choices
. An IllegalArgumentException
is thrown
if you set this to false and choices
is null
or empty.
Possible input choices. This can be null
if there are no choices to present.
The lookup key for the intent extra that the response is set in. This is populated
when the PendingIntent
is sent.