RemoteInputIntent

public class RemoteInputIntent
extends Object

java.lang.Object
   ↳ android.support.wearable.input.RemoteInputIntent


Constants for supporting remote inputs through starting an Intent.

The following example prompts the user to provide input for one RemoteInput by starting an input activity.

 public static final String KEY_QUICK_REPLY_TEXT = "quick_reply";
 RemoteInput[] remoteInputs = new RemoteInput[] {
     new RemoteInput.Builder(KEY_QUICK_REPLY_TEXT).setLabel("Quick reply").build()
 };
 Intent intent = new Intent(ACTION_REMOTE_INPUT);
 intent.putExtra(EXTRA_REMOTE_INPUTS, remoteInputs);
 startActivity(intent);
 

The intent returned via onActivityResult(int, int, Intent) will contain the input results if collected. To access these results, use the getResultsFromIntent(Intent) function. The result values will present under the result key passed to the RemoteInput.Builder constructor.

 public static final String KEY_QUICK_REPLY_TEXT = "quick_reply";
 Bundle results = RemoteInput.getResultsFromIntent(intent);
 if (results != null) {
     CharSequence quickReplyResult = results.getCharSequence(KEY_QUICK_REPLY_TEXT);
 }

Summary

Constants

String ACTION_REMOTE_INPUT

Starts an activity that will prompt the user for inputs based on the RemoteInput.

String EXTRA_CANCEL_LABEL

Optional string to display to cancel the action.

String EXTRA_CONFIRM_LABEL

Optional string to display to confirm that the action should be executed.

String EXTRA_IN_PROGRESS_LABEL

Optional string to display while the wearable is preparing to automatically execute the action.

String EXTRA_REMOTE_INPUTS

Array of RemoteInput, to be used with ACTION_REMOTE_INPUT, to specify inputs to be collected from a user.

String EXTRA_SKIP_CONFIRMATION_UI

Optional boolean, to be used with ACTION_REMOTE_INPUT, to determine if a confirmation screen should be shown to a user after entering input.

String EXTRA_SMART_REPLY_CONTEXT

Optional CharSequence[] to be used to provide context for creating Smart Reply choices within a RemoteInput session.

String EXTRA_TITLE

String to display on top of the confirmation screen to describe the action like "SMS" or "Email".

Public constructors

RemoteInputIntent()

Inherited methods

From class java.lang.Object

Constants

ACTION_REMOTE_INPUT

String ACTION_REMOTE_INPUT

Starts an activity that will prompt the user for inputs based on the RemoteInput. The results will be returned via activity results (in onActivityResult(int, int, Intent). To retrieve the user's inputs, getResultsFromIntent(Intent) should be called to get a bundle containing a key/value for every result key populated by remote input collector.

When using this action, the extra EXTRA_REMOTE_INPUTS should be populated with an array of RemoteInput.

Constant Value: "android.support.wearable.input.action.REMOTE_INPUT"

EXTRA_CANCEL_LABEL

String EXTRA_CANCEL_LABEL

Optional string to display to cancel the action. This is usually an imperative verb, like "Cancel". Defaults to Cancel.

Constant Value: "android.support.wearable.input.extra.CANCEL_LABEL"

EXTRA_CONFIRM_LABEL

String EXTRA_CONFIRM_LABEL

Optional string to display to confirm that the action should be executed. This is usually an imperative verb like "Send". Defaults to "Send".

Constant Value: "android.support.wearable.input.extra.CONFIRM_LABEL"

EXTRA_IN_PROGRESS_LABEL

String EXTRA_IN_PROGRESS_LABEL

Optional string to display while the wearable is preparing to automatically execute the action. This is usually a 'ing' verb ending in ellipsis like "Sending...". Defaults to "Sending...".

Constant Value: "android.support.wearable.input.extra.IN_PROGRESS_LABEL"

EXTRA_REMOTE_INPUTS

String EXTRA_REMOTE_INPUTS

Array of RemoteInput, to be used with ACTION_REMOTE_INPUT, to specify inputs to be collected from a user.

Constant Value: "android.support.wearable.input.extra.REMOTE_INPUTS"

EXTRA_SKIP_CONFIRMATION_UI

String EXTRA_SKIP_CONFIRMATION_UI

Optional boolean, to be used with ACTION_REMOTE_INPUT, to determine if a confirmation screen should be shown to a user after entering input. This field defaults to true, meaning that the confirmation screen will be skipped and not shown to a user before results are returned via activity results. If a full screen confirmation is required, this extra must be provided and should be false.

Note that the default behavior of this extra has changed in Android Wear 2.0. Each input method (voice, keyboard, emoji, handwriting, etc) is responsible for showing its own confirmation step. Because of this, the default value for this extra has been changed from false to true.

Constant Value: "android.support.wearable.input.extra.SKIP_CONFIRMATION_UI"

EXTRA_SMART_REPLY_CONTEXT

String EXTRA_SMART_REPLY_CONTEXT

Optional CharSequence[] to be used to provide context for creating Smart Reply choices within a RemoteInput session. The context should be incoming chat messages that a user will reply to using RemoteInput. Only incoming messages (messages from other users) should be passed via this extra.

The messages should be in the order that they were received with the newest messages at the highest index of the CharSequence[]. For example, a possible value for this extra would be: ["hey", "where are you?"]. In this case, "where are you?" was the most recently received message.

Passing a chat context into RemoteInput using this extra does not guarantee that Smart Reply choices will be shown to a user.

Constant Value: "android.support.wearable.input.extra.SMART_REPLY_CONTEXT"

EXTRA_TITLE

String EXTRA_TITLE

String to display on top of the confirmation screen to describe the action like "SMS" or "Email".

Constant Value: "android.support.wearable.input.extra.TITLE"

Public constructors

RemoteInputIntent

RemoteInputIntent ()