Skip to content

Most visited

Recently visited

navigation

RemoteInput

public final class RemoteInput
extends RemoteInputCompatBase.RemoteInput

java.lang.Object
   ↳ android.support.v4.app.RemoteInputCompatBase.RemoteInput
     ↳ 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<StringUri> 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<StringUri> 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 android.support.v4.app.RemoteInputCompatBase.RemoteInput
From class java.lang.Object

Constants

EXTRA_RESULTS_DATA

added in version 22.0.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.0.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.0.0
void addDataResultToIntent (RemoteInput remoteInput, 
                Intent intent, 
                Map<StringUri> 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.0.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.0.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.0.0
Set<String> getAllowedDataTypes ()

Returns
Set<String>

getChoices

added in version 22.0.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.0.0
Map<StringUri> 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<StringUri>

getExtras

added in version 22.0.0
Bundle getExtras ()

Get additional metadata carried around with this remote input.

Returns
Bundle

getLabel

added in version 22.0.0
CharSequence getLabel ()

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

Returns
CharSequence

getResultKey

added in version 22.0.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.0.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.0.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

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)