added in version 22.1.0
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1

RemoteInput

public final class RemoteInput
extends Object

java.lang.Object
   ↳ android.support.v4.app.RemoteInput


Helper for using the RemoteInput.

Summary

Nested classes

class RemoteInput.Builder

Builder class for RemoteInput objects. 

Constants

String EXTRA_RESULTS_DATA

Extra added to a clip data intent object to hold the text results bundle.

String RESULTS_CLIP_LABEL

Label used to denote the clip data type used for remote input transport

Public methods

static void addDataResultToIntent(RemoteInput remoteInput, Intent intent, Map<String, Uri> results)

Same as addResultsToIntent(RemoteInput[], Intent, Bundle) but for setting data results.

static void addResultsToIntent(RemoteInput[] remoteInputs, Intent intent, Bundle results)

Populate an intent object with the results gathered from remote input.

boolean getAllowFreeFormInput()

Get whether or not users can provide an arbitrary value for input.

Set<String> getAllowedDataTypes()
CharSequence[] getChoices()

Get possible input choices.

static Map<String, Uri> getDataResultsFromIntent(Intent intent, String remoteInputResultKey)

Similar as getResultsFromIntent(Intent) but retrieves data results for a specific RemoteInput result.

Bundle getExtras()

Get additional metadata carried around with this remote input.

CharSequence getLabel()

Get the label to display to users when collecting this input.

String getResultKey()

Get the key that the result of this input will be set in from the Bundle returned by getResultsFromIntent(Intent) when the PendingIntent is sent.

static Bundle getResultsFromIntent(Intent intent)

Get the remote input text results bundle from an intent.

boolean isDataOnly()

Returns true if the input only accepts data, meaning getAllowFreeFormInput() is false, getChoices() is null or empty, and {@link #getAllowedDataTypes is non-null and not empty.

Inherited methods

From class java.lang.Object

Constants

EXTRA_RESULTS_DATA

added in version 22.1.0
String EXTRA_RESULTS_DATA

Extra added to a clip data intent object to hold the text results bundle.

Constant Value: "android.remoteinput.resultsData"

RESULTS_CLIP_LABEL

added in version 22.1.0
String RESULTS_CLIP_LABEL

Label used to denote the clip data type used for remote input transport

Constant Value: "android.remoteinput.results"

Public methods

addDataResultToIntent

added in version 26.1.0
void addDataResultToIntent (RemoteInput remoteInput, 
                Intent intent, 
                Map<String, Uri> results)

Same as addResultsToIntent(RemoteInput[], Intent, Bundle) but for setting data results.

Parameters
remoteInput RemoteInput: The remote input for which results are being provided

intent Intent: The intent to add remote input results to. The ClipData field of the intent will be modified to contain the results.

results Map: A map of mime type to the Uri result for that mime type.

addResultsToIntent

added in version 22.1.0
void addResultsToIntent (RemoteInput[] remoteInputs, 
                Intent intent, 
                Bundle results)

Populate an intent object with the results gathered from remote input. This method should only be called by remote input collection services when sending results to a pending intent.

Parameters
remoteInputs RemoteInput: The remote inputs for which results are being provided

intent Intent: The intent to add remote inputs to. The ClipData field of the intent will be modified to contain the results.

results Bundle: A bundle holding the remote input results. This bundle should be populated with keys matching the result keys specified in remoteInputs with values being the result per key.

getAllowFreeFormInput

added in version 22.1.0
boolean getAllowFreeFormInput ()

Get whether or not users can provide an arbitrary value for input. If you set this to false, users must select one of the choices in getChoices(). An IllegalArgumentException is thrown if you set this to false and getChoices() returns null or empty.

Returns
boolean

getAllowedDataTypes

added in version 26.1.0
Set<String> getAllowedDataTypes ()

Returns
Set<String>

getChoices

added in version 22.1.0
CharSequence[] getChoices ()

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

Returns
CharSequence[]

getDataResultsFromIntent

added in version 26.1.0
Map<String, Uri> getDataResultsFromIntent (Intent intent, 
                String remoteInputResultKey)

Similar as getResultsFromIntent(Intent) but retrieves data results for a specific RemoteInput result. To retrieve a value use:

 Map<String, Uri> results =
     RemoteInput.getDataResultsFromIntent(intent, REMOTE_INPUT_KEY);
 if (results != null) {
   Uri data = results.get(MIME_TYPE_OF_INTEREST);
 }
 
 

Parameters
intent Intent: The intent object that fired in response to an action or content intent which also had one or more remote input requested.

remoteInputResultKey String: The result key for the RemoteInput you want results for.

Returns
Map<String, Uri>

getExtras

added in version 22.1.0
Bundle getExtras ()

Get additional metadata carried around with this remote input.

Returns
Bundle

getLabel

added in version 22.1.0
CharSequence getLabel ()

Get the label to display to users when collecting this input.

Returns
CharSequence

getResultKey

added in version 22.1.0
String getResultKey ()

Get the key that the result of this input will be set in from the Bundle returned by getResultsFromIntent(Intent) when the PendingIntent is sent.

Returns
String

getResultsFromIntent

added in version 22.1.0
Bundle getResultsFromIntent (Intent intent)

Get the remote input text results bundle from an intent. The returned Bundle will contain a key/value for every result key populated by remote input collector. Use the getCharSequence(String) method to retrieve a value. For data results use getDataResultsFromIntent(Intent, String).

Parameters
intent Intent: The intent object that fired in response to an action or content intent which also had one or more remote input requested.

Returns
Bundle

isDataOnly

added in version 26.1.0
boolean isDataOnly ()

Returns true if the input only accepts data, meaning getAllowFreeFormInput() is false, getChoices() is null or empty, and {@link #getAllowedDataTypes is non-null and not empty.

Returns
boolean