# RemoteInput

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/app/RemoteInput.java+class:androidx.core.app.RemoteInput) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***


```
public final class RemoteInput
```

<br />

*** ** * ** ***

Helper for using the `https://developer.android.com/reference/android/app/RemoteInput.html`.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/core/app/RemoteInput.Builder` Builder class for `https://developer.android.com/reference/androidx/core/app/RemoteInput` objects. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#EDIT_CHOICES_BEFORE_SENDING_AUTO() = 0` The platform will determine whether choices will be edited before being sent to the app. |
| `static final int` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#EDIT_CHOICES_BEFORE_SENDING_DISABLED() = 1` Tapping on a choice should send the input immediately, without letting the user edit it. |
| `static final int` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#EDIT_CHOICES_BEFORE_SENDING_ENABLED() = 2` Tapping on a choice should let the user edit the input before it is sent to the app. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#EXTRA_RESULTS_DATA() = "android.remoteinput.resultsData"` Extra added to a clip data intent object to hold the text results bundle. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#RESULTS_CLIP_LABEL() = "android.remoteinput.results"` Label used to denote the clip data type used for remote input transport |
| `static final int` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#SOURCE_CHOICE() = 1` The user selected one of the choices from `https://developer.android.com/reference/androidx/core/app/RemoteInput#getChoices()`. |
| `static final int` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#SOURCE_FREE_FORM_INPUT() = 0` The user manually entered the data. |

| ### Public methods |
|---|---|
| `static void` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#addDataResultToIntent(androidx.core.app.RemoteInput,android.content.Intent,java.util.Map<java.lang.String,android.net.Uri>)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/RemoteInput remoteInput, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/Map.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/android/net/Uri.html> results )` Same as `https://developer.android.com/reference/androidx/core/app/RemoteInput#addResultsToIntent(androidx.core.app.RemoteInput[],android.content.Intent,android.os.Bundle)` but for setting data results. |
| `static void` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#addResultsToIntent(androidx.core.app.RemoteInput[],android.content.Intent,android.os.Bundle)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html RemoteInput[] remoteInputs, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html results )` Populate an intent object with the results gathered from remote input. |
| `boolean` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#getAllowFreeFormInput()()` Get whether or not users can provide an arbitrary value for input. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#getAllowedDataTypes()()` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html CharSequence[]` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#getChoices()()` Get possible input choices. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/Map.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/android/net/Uri.html>` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#getDataResultsFromIntent(android.content.Intent,java.lang.String)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html remoteInputResultKey )` Similar as `https://developer.android.com/reference/androidx/core/app/RemoteInput#getResultsFromIntent(android.content.Intent)` but retrieves data results for a specific RemoteInput result. |
| `int` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#getEditChoicesBeforeSending()()` Gets whether tapping on a choice should let the user edit the input before it is sent to the app. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#getExtras()()` Get additional metadata carried around with this remote input. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#getLabel()()` Get the label to display to users when collecting this input. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#getResultKey()()` Get the key that the result of this input will be set in from the Bundle returned by `https://developer.android.com/reference/androidx/core/app/RemoteInput#getResultsFromIntent(android.content.Intent)` when the `https://developer.android.com/reference/android/app/PendingIntent.html` is sent. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#getResultsFromIntent(android.content.Intent)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent)` Get the remote input text results bundle from an intent. |
| `static int` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#getResultsSource(android.content.Intent)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent)` Get the source of the RemoteInput results. |
| `boolean` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#isDataOnly()()` Returns true if the input only accepts data, meaning `https://developer.android.com/reference/androidx/core/app/RemoteInput#getAllowFreeFormInput()` is false, `https://developer.android.com/reference/androidx/core/app/RemoteInput#getChoices()` is null or empty, and `https://developer.android.com/reference/androidx/core/app/RemoteInput#getAllowedDataTypes()` is non-null and not empty. |
| `static void` | `https://developer.android.com/reference/androidx/core/app/RemoteInput#setResultsSource(android.content.Intent,int)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent, int source)` Set the source of the RemoteInput results. |

## Constants

### EDIT_CHOICES_BEFORE_SENDING_AUTO

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
public static final int EDIT_CHOICES_BEFORE_SENDING_AUTO = 0
```

The platform will determine whether choices will be edited before being sent to the app.

### EDIT_CHOICES_BEFORE_SENDING_DISABLED

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
public static final int EDIT_CHOICES_BEFORE_SENDING_DISABLED = 1
```

Tapping on a choice should send the input immediately, without letting the user edit it.

### EDIT_CHOICES_BEFORE_SENDING_ENABLED

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
public static final int EDIT_CHOICES_BEFORE_SENDING_ENABLED = 2
```

Tapping on a choice should let the user edit the input before it is sent to the app.

### EXTRA_RESULTS_DATA

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final String EXTRA_RESULTS_DATA = "android.remoteinput.resultsData"
```

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

### RESULTS_CLIP_LABEL

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final String RESULTS_CLIP_LABEL = "android.remoteinput.results"
```

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

### SOURCE_CHOICE

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int SOURCE_CHOICE = 1
```

The user selected one of the choices from `https://developer.android.com/reference/androidx/core/app/RemoteInput#getChoices()`.

### SOURCE_FREE_FORM_INPUT

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int SOURCE_FREE_FORM_INPUT = 0
```

The user manually entered the data.

## Public methods

### addDataResultToIntent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

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

Same as `https://developer.android.com/reference/androidx/core/app/RemoteInput#addResultsToIntent(androidx.core.app.RemoteInput[],android.content.Intent,android.os.Bundle)` but for setting data results.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/RemoteInput remoteInput` | The remote input for which results are being provided |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent` | The intent to add remote input results to. The `https://developer.android.com/reference/android/content/ClipData.html` field of the intent will be modified to contain the results. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/Map.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/android/net/Uri.html> results` | A map of mime type to the Uri result for that mime type. |

### addResultsToIntent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static void addResultsToIntent(
    @NonNull RemoteInput[] remoteInputs,
    @NonNull Intent intent,
    @NonNull 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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html RemoteInput[] remoteInputs` | The remote inputs for which results are being provided |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent` | The intent to add remote inputs to. The `https://developer.android.com/reference/android/content/ClipData.html` field of the intent will be modified to contain the results. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html results` | 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 [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public 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 `https://developer.android.com/reference/androidx/core/app/RemoteInput#getChoices()`. An `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` is thrown if you set this to false and `https://developer.android.com/reference/androidx/core/app/RemoteInput#getChoices()` returns `null` or empty.

### getAllowedDataTypes

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public @Nullable Set<String> getAllowedDataTypes()
```

### getChoices

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public @Nullable CharSequence[] getChoices()
```

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

### getDataResultsFromIntent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static @Nullable Map<String, Uri> getDataResultsFromIntent(
    @NonNull Intent intent,
    @NonNull String remoteInputResultKey
)
```

Similar as `https://developer.android.com/reference/androidx/core/app/RemoteInput#getResultsFromIntent(android.content.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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent` | The intent object that fired in response to an action or content intent which also had one or more remote input requested. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html remoteInputResultKey` | The result key for the RemoteInput you want results for. |

### getEditChoicesBeforeSending

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
public int getEditChoicesBeforeSending()
```

Gets whether tapping on a choice should let the user edit the input before it is sent to the app.

### getExtras

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public @NonNull Bundle getExtras()
```

Get additional metadata carried around with this remote input.

### getLabel

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public @Nullable CharSequence getLabel()
```

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

### getResultKey

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public @NonNull String getResultKey()
```

Get the key that the result of this input will be set in from the Bundle returned by `https://developer.android.com/reference/androidx/core/app/RemoteInput#getResultsFromIntent(android.content.Intent)` when the `https://developer.android.com/reference/android/app/PendingIntent.html` is sent.

### getResultsFromIntent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static @Nullable Bundle getResultsFromIntent(@NonNull 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 `https://developer.android.com/reference/android/os/Bundle.html#getCharSequence(java.lang.String)` method to retrieve a value. For data results use `https://developer.android.com/reference/androidx/core/app/RemoteInput#getDataResultsFromIntent(android.content.Intent,java.lang.String)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent` | The intent object that fired in response to an action or content intent which also had one or more remote input requested. |

### getResultsSource

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static int getResultsSource(@NonNull Intent intent)
```

Get the source of the RemoteInput results.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent` | The intent object that fired in response to an action or content intent which also had one or more remote input requested. |

| Returns |
|---|---|
| `int` | The source of the results. If no source was set, `https://developer.android.com/reference/androidx/core/app/RemoteInput#SOURCE_FREE_FORM_INPUT()` will be returned. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/RemoteInput#SOURCE_FREE_FORM_INPUT()` |   |
| `https://developer.android.com/reference/androidx/core/app/RemoteInput#SOURCE_CHOICE()` |   |

### isDataOnly

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public boolean isDataOnly()
```

Returns true if the input only accepts data, meaning `https://developer.android.com/reference/androidx/core/app/RemoteInput#getAllowFreeFormInput()` is false, `https://developer.android.com/reference/androidx/core/app/RemoteInput#getChoices()` is null or empty, and `https://developer.android.com/reference/androidx/core/app/RemoteInput#getAllowedDataTypes()` is non-null and not empty.

### setResultsSource

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static void setResultsSource(@NonNull Intent intent, int source)
```

Set the source of the RemoteInput results. This method should only be called by remote input collection services (e.g. `https://developer.android.com/reference/android/service/notification/NotificationListenerService.html`) when sending results to a pending intent.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent` | The intent to add remote input source to. The `https://developer.android.com/reference/android/content/ClipData.html` field of the intent will be modified to contain the source. |
| `int source` | The source of the results. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/RemoteInput#SOURCE_FREE_FORM_INPUT()` |   |
| `https://developer.android.com/reference/androidx/core/app/RemoteInput#SOURCE_CHOICE()` |   |