public class

RemoteInput

extends Object
implements Parcelable
java.lang.Object
   ↳ android.preview.support.wearable.notifications.RemoteInput

Class Overview

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();

Summary

Nested Classes
class RemoteInput.Builder Builder class for RemoteInput objects. 
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<RemoteInput> CREATOR
public final boolean allowFreeFormInput Indicates whether or not users can provide an arbitrary value for input.
public final String[] choices Possible input choices.
public final String label The label to display to users when collecting this input.
public final String returnKey The lookup key for the intent extra that the response is set in.
Public Methods
int describeContents()
void writeToParcel(Parcel out, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator<RemoteInput> CREATOR

public final boolean allowFreeFormInput

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.

public final String[] choices

Possible input choices. This can be null if there are no choices to present.

public final String label

The label to display to users when collecting this input.

public final String returnKey

The lookup key for the intent extra that the response is set in. This is populated when the PendingIntent is sent.

Public Methods

public int describeContents ()

public void writeToParcel (Parcel out, int flags)