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); }
Constants | |
---|---|
String |
ACTION_REMOTE_INPUT
Starts an activity that will prompt the user for inputs based on the
|
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 |
String |
EXTRA_SKIP_CONFIRMATION_UI
Optional boolean, to be used with |
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
|
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"
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"
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"
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"
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"
String EXTRA_SKIP_CONFIRMATION_UI
Optional boolean, to be used with ACTION_REMOTE_INPUT
, to indicate if a
confirmation screen should be displayed to the user after he entered its input.
The defaults is true, meaning that a confirmation screen will be displayed to the user
before results are returned via activity results.
Constant Value: "android.support.wearable.input.extra.SKIP_CONFIRMATION_UI"
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"
RemoteInputIntent ()